From a4625499c0af2498b9484e29a2b3c31ed480058f Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Thu, 15 Mar 2018 11:21:41 +0100 Subject: [PATCH] Override email value --- override/controllers/AuthController.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/override/controllers/AuthController.php b/override/controllers/AuthController.php index ae1af20c..e3fce904 100755 --- a/override/controllers/AuthController.php +++ b/override/controllers/AuthController.php @@ -239,14 +239,16 @@ class AuthController extends AuthControllerCore $_POST['firstname'] = $firstnameAddress; if (!sizeof($this->errors)) { - if(Customer::customerExists($email)) { + if (Customer::customerExists($email)) { $this->errors[] = Tools::displayError('An account is already registered with this e-mail, please fill in the password or request a new one.'); } - if(Tools::isSubmit('newsletter')) { + + if (Tools::isSubmit('newsletter')) { $customer->ip_registration_newsletter = pSQL(Tools::getRemoteAddr()); $customer->newsletter_date_add = pSQL(date('Y-m-d H:i:s')); } + $customer->email = $_POST['email'] = $email; $customer->birthday = (empty($_POST['years'])? '': (int)($_POST['years']).'-'.(int)($_POST['months']).'-'.(int)($_POST['days'])); if (!sizeof($this->errors)) { @@ -257,13 +259,20 @@ class AuthController extends AuthControllerCore } else { $customer->is_guest = 0; } + if (!$customer->add()) { $this->errors[] = Tools::displayError('An error occurred while creating your account.'); } else { - if(!$customer->is_guest) { + if (!$customer->is_guest) { if(!Mail::Send((int)(self::$cookie->id_lang), 'account', Mail::l('Welcome!'), - array('{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{email}' => $customer->email, '{passwd}' => Tools::getValue('passwd')), $customer->email, $customer->firstname.' '.$customer->lastname)) - $this->errors[] = Tools::displayError('Cannot send email'); + array( + '{firstname}' => $customer->firstname, + '{lastname}' => $customer->lastname, + '{email}' => $customer->email, + '{passwd}' => Tools::getValue('passwd') + ), $customer->email, $customer->firstname.' '.$customer->lastname)) { + $this->errors[] = Tools::displayError('Cannot send email'); + } } global $site_version_front;