diff --git a/lib/classes/mail.class.php b/lib/classes/mail.class.php
index a726f4dc2a..3c5786ccff 100644
--- a/lib/classes/mail.class.php
+++ b/lib/classes/mail.class.php
@@ -75,6 +75,18 @@ class mail
return self::send_mail($subject, $body, $to);
}
+ public static function change_password(User_Adapter $user)
+ {
+ $subject = _('Password has been changed');
+
+ $body = "
" . _('This email warn you that the password for the following login account has been changed recently ')
+ . "
\n\n" . $login . "
\n\n";
+
+ $to = array('email' => $user->get_email(), 'name' => $user->get_email());
+
+ return self::send_mail($subject, $body, $to);
+ }
+
public static function register_confirm($email, $accept, $deny)
{
$registry = registry::get_instance();
diff --git a/www/login/forgotpwd.php b/www/login/forgotpwd.php
index 2e958cc8cf..7edd23ff6c 100644
--- a/www/login/forgotpwd.php
+++ b/www/login/forgotpwd.php
@@ -65,6 +65,9 @@ if (isset($parm['token']) && isset($parm['form_password']) && isset($parm['form_
$datas = random::helloToken($parm['token']);
$user = User_Adapter::getInstance($datas['usr_id'], $appbox);
$user->set_password($parm['form_password_confirm']);
+
+ mail::change_password($user);
+
random::removeToken($parm['token']);
return phrasea::redirect('/login/index.php?confirm=password-update-ok');
diff --git a/www/login/reset-password.php b/www/login/reset-password.php
index f4ef844200..483417c5cc 100644
--- a/www/login/reset-password.php
+++ b/www/login/reset-password.php
@@ -54,6 +54,8 @@ if ( ! is_null($parm['form_old_password']) && ! is_null($parm['form_password'])
$auth->challenge_password();
$user->set_password($parm['form_password_confirm']);
+ mail::change_password($user);
+
return phrasea::redirect('/login/account.php?notice=password-update-ok');
} catch (Exception $e) {
$error = true;