Vérification modification du compte, erreur si un compte existe déjà

This commit is contained in:
Michael RICOIS 2018-02-09 11:49:12 +01:00
parent f53dee8581
commit e2a9475ec7

View File

@ -4,6 +4,19 @@ class IdentityController extends IdentityControllerCore
public function preProcess()
{
self::$smarty->assign(array('HOOK_PROFILE_EDIT' => Module::hookExec('profileEdit')));
if (Tools::isSubmit('submitIdentity')) {
$customer = new Customer((int)(self::$cookie->id_customer));
if (isset($_POST['email'])) {
$_POST['email'] = strtolower(trim($_POST['email']));
if ($_POST['email'] != $customer->email) {
if (Customer::customerExists($_POST['email'])) {
$this->errors[] = Tools::displayError('An account is already registered with this e-mail');
}
}
}
}
parent::preProcess();
}