fix #750 Warn by mail that user passwaord has been changed

This commit is contained in:
Nicolas Le Goff
2012-06-21 18:21:57 +02:00
parent 34ca20116c
commit 4cd0db1bfb
3 changed files with 17 additions and 0 deletions

View File

@@ -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 = "<div>" . _('This email warn you that the password for the following login account has been changed recently ')
. "</div><div>\n\n" . $login . "</div>\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();

View File

@@ -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');

View File

@@ -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;