Override email value

This commit is contained in:
Michael RICOIS 2018-03-15 11:21:41 +01:00
parent eea2e769d1
commit a4625499c0

View File

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