diff --git a/override/controllers/AuthController.php b/override/controllers/AuthController.php index 74591cd6..e0d25305 100755 --- a/override/controllers/AuthController.php +++ b/override/controllers/AuthController.php @@ -1,6 +1,8 @@ php_self)) { @@ -79,42 +81,47 @@ class AuthController extends AuthControllerCore { Module::hookExec('preprocess'); - if(self::$cookie->isLogged() && !Tools::isSubmit('ajax')) { + if (self::$cookie->isLogged() && !Tools::isSubmit('ajax')) { Tools::redirect('/'); } - if(Tools::getValue('create_account')) { + if (Tools::getValue('create_account')) { $create_account = 1; self::$smarty->assign('email_create', 1); } - if(Tools::isSubmit('SubmitCreate')) { + if (Tools::isSubmit('SubmitCreate')) { $create_account = 1; self::$smarty->assign('email_create', Tools::safeOutput($email)); } - if(Tools::isSubmit('submitAccount') || Tools::isSubmit('submitGuestAccount')) { + if (Tools::isSubmit('submitAccount') || Tools::isSubmit('submitGuestAccount')) { $create_account = 1; - if(Tools::isSubmit('submitAccount')) - self::$smarty->assign('email_create', 1); - /* New Guest customer */ - if(!Tools::getValue('is_new_customer', 1) && !Configuration::get('PS_GUEST_CHECKOUT_ENABLED')) { + if(Tools::isSubmit('submitAccount')) { + self::$smarty->assign('email_create', 1); + } + + /* New Guest customer */ + if (!Tools::getValue('is_new_customer', 1) && !Configuration::get('PS_GUEST_CHECKOUT_ENABLED')) { $this->errors[] = Tools::displayError('You cannot create a guest account.'); } - if(!Tools::getValue('is_new_customer', 1)) { + + if (!Tools::getValue('is_new_customer', 1)) { $_POST['passwd'] = md5(time()._COOKIE_KEY_); } - if(isset($_POST['guest_email']) && $_POST['guest_email']) { - $_POST['email'] = $_POST['guest_email']; + + $email = Tools::getValue('email'); + if (Tools::getValue('guest_email') !== false) { + $email = Tools::getValue('guest_email'); } + $email = trim($email); - $_POST['email'] = trim($_POST['email']); /** @Override Antadis - mail fixing */ - $_POST['email'] = str_replace(array('@hotmil.','@htmail.','@hotmal.','@hotml.','@hotmai.'),'@hotmail.',$_POST['email']); - $_POST['email'] = str_replace(array('@gmal.','@gail.','@gml.','@gmai.','@gmil.'),'@gmail.',$_POST['email']); - $_POST['email'] = str_replace('@gmailcom','@gmail.com',$_POST['email']); - $_POST['email'] = str_replace('@hotmailcom','@hotmail.com',$_POST['email']); - $_POST['email'] = str_replace('@hotmailfr','@hotmail.fr',$_POST['email']); + $email = str_replace(array('@hotmil.','@htmail.','@hotmal.','@hotml.','@hotmai.'),'@hotmail.', $email); + $email = str_replace(array('@gmal.','@gail.','@gml.','@gmai.','@gmil.'),'@gmail.', $email); + $email = str_replace('@gmailcom','@gmail.com', $email); + $email = str_replace('@hotmailcom','@hotmail.com', $email); + $email = str_replace('@hotmailfr','@hotmail.fr', $email); /** @End Override Antadis - mail fixing */ /* Preparing customer */ @@ -133,7 +140,7 @@ class AuthController extends AuthControllerCore { $_POST['firstname'] = $firstnameAddress; if(!sizeof($this->errors)) { - if(Customer::customerExists(Tools::getValue('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')) {