From 1a8088fcd91b805a8b27ecdbc715ff97535f117e Mon Sep 17 00:00:00 2001 From: mDeflotte Date: Thu, 24 May 2012 13:20:50 +0000 Subject: [PATCH] [-] BO : #PSCFV-2556 #PSCFV-2550 - Fix password alert message "é" --- controllers/admin/AdminLoginController.php | 38 ++++++++++++---------- translations/fr/admin.php | 2 +- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/controllers/admin/AdminLoginController.php b/controllers/admin/AdminLoginController.php index 95b4cd43e..34c314266 100755 --- a/controllers/admin/AdminLoginController.php +++ b/controllers/admin/AdminLoginController.php @@ -203,29 +203,31 @@ class AdminLoginControllerCore extends AdminController $pwd = Tools::passwdGen(); $employee->passwd = md5(pSQL(_COOKIE_KEY_.$pwd)); $employee->last_passwd_gen = date('Y-m-d H:i:s', time()); - $result = $employee->update(); - if (!$result) - $this->errors[] = Tools::displayError('An error occurred during your password change.'); - else + + $params = array( + '{email}' => $employee->email, + '{lastname}' => $employee->lastname, + '{firstname}' => $employee->firstname, + '{passwd}' => $pwd + ); + + if (Mail::Send((int)Configuration::get('PS_LANG_DEFAULT'), 'password', Mail::l('Your new admin password', (int)Configuration::get('PS_LANG_DEFAULT')), $params, $employee->email, $employee->firstname.' '.$employee->lastname)) { - $params = array( - '{email}' => $employee->email, - '{lastname}' => $employee->lastname, - '{firstname}' => $employee->firstname, - '{passwd}' => $pwd - ); - - if (Mail::Send((int)Configuration::get('PS_LANG_DEFAULT'), 'password', Mail::l('Your new admin password', (int)Configuration::get('PS_LANG_DEFAULT')), $params, $employee->email, $employee->firstname.' '.$employee->lastname)) - die(Tools::jsonEncode(array( - 'hasErrors' => false, - 'confirm' => $this->l('Your password has been e-mailed to you') - ))); + // Update employee only if the mail can be sent + $result = $employee->update(); + if (!$result) + $this->errors[] = Tools::displayError('An error occurred during your password change.'); else die(Tools::jsonEncode(array( - 'hasErrors' => true, - 'errors' => array(Tools::displayError('An error occurred during your password change.')) + 'hasErrors' => false, + 'confirm' => $this->l('Your password has been e-mailed to you', 'AdminTab', false, false) ))); } + else + die(Tools::jsonEncode(array( + 'hasErrors' => true, + 'errors' => array(Tools::displayError('An error occurred during your password change.')) + ))); } else if (Tools::isSubmit('ajax')) diff --git a/translations/fr/admin.php b/translations/fr/admin.php index 8d7da836f..b6d42be3c 100644 --- a/translations/fr/admin.php +++ b/translations/fr/admin.php @@ -1621,7 +1621,7 @@ $_LANGADM['AdminLogin345d82a66ff0b2acff929bbab85ed936'] = 'renommé le dossier / $_LANGADM['AdminLogin34bdd7b9823059fa742afab7be9d4c58'] = 'Votre mot de passe vous a été envoyé par e-mail'; $_LANGADM['AdminLogin362b56674d07160fab60725a927bbf13'] = 'supprimé le dossier /install'; $_LANGADM['AdminLogin463e58c1d35fb5a4a8d717c99a60d257'] = 'Retour à la connexion'; -$_LANGADM['AdminLogin485f5be5d5e3cd5d46ab3cd3792765c8'] = 'Veuillez saisir l\'adresse e-mail indiquée à lors de votre inscription afin de recevoir vos codes d\'accès par e-mail.'; +$_LANGADM['AdminLogin485f5be5d5e3cd5d46ab3cd3792765c8'] = 'Veuillez saisir l\'adresse e-mail indiquée lors de votre inscription afin de recevoir vos codes d\'accès par e-mail.'; $_LANGADM['AdminLogin4ce81305b7edb043d0a7a5c75cab17d0'] = 'Il y a'; $_LANGADM['AdminLogin6357d3551190ec7e79371a8570121d3a'] = 'Il y a'; $_LANGADM['AdminLogin69f4ac57f3127f55fffc6a5e65fd2a21'] = 'Veuillez alors accéder à la page par la nouvelle URL, par exemple http://www.domaine.fr/admin123%d';