From 72efc062513a5ff70f8ca86cd7dea99e99508460 Mon Sep 17 00:00:00 2001 From: lLefevre Date: Tue, 24 Apr 2012 13:42:43 +0000 Subject: [PATCH] [-] BO : Fix #PSFV-549 : Now two customer with the same mail, isn't possible --- controllers/front/IdentityController.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/controllers/front/IdentityController.php b/controllers/front/IdentityController.php index 674e3dce1..563086e86 100644 --- a/controllers/front/IdentityController.php +++ b/controllers/front/IdentityController.php @@ -56,6 +56,9 @@ class IdentityControllerCore extends FrontController { $this->customer->birthday = (empty($_POST['years']) ? '' : (int)($_POST['years']).'-'.(int)($_POST['months']).'-'.(int)($_POST['days'])); + if (Customer::customerExists(Tools::getValue('email'), true)) + $this->errors[] = Tools::displayError('An account is already registered with this e-mail.'); + $_POST['old_passwd'] = trim($_POST['old_passwd']); if (empty($_POST['old_passwd']) || (Tools::encrypt($_POST['old_passwd']) != $this->context->cookie->passwd)) $this->errors[] = Tools::displayError('Your password is incorrect.'); @@ -64,8 +67,11 @@ class IdentityControllerCore extends FrontController else { $prev_id_default_group = $this->customer->id_default_group; - $this->errors = $this->customer->validateController(); + + // Merge all errors of this file and of the Object Model + $this->errors = array_merge($this->errors, $this->customer->validateController()); } + if (!count($this->errors)) { $this->customer->id_default_group = (int)($prev_id_default_group);