Var email

This commit is contained in:
Michael RICOIS 2018-02-08 17:31:49 +01:00
parent 54781041ee
commit ca461979c4

View File

@ -1,6 +1,8 @@
<?php <?php
class AuthController extends AuthControllerCore { class AuthController extends AuthControllerCore
public function preProcess() { {
public function preProcess()
{
// We can't run parent::preProcess() here since it would run the authentication process // We can't run parent::preProcess() here since it would run the authentication process
if(!isset($this->php_self)) { if(!isset($this->php_self)) {
@ -79,42 +81,47 @@ class AuthController extends AuthControllerCore {
Module::hookExec('preprocess'); Module::hookExec('preprocess');
if(self::$cookie->isLogged() && !Tools::isSubmit('ajax')) { if (self::$cookie->isLogged() && !Tools::isSubmit('ajax')) {
Tools::redirect('/'); Tools::redirect('/');
} }
if(Tools::getValue('create_account')) { if (Tools::getValue('create_account')) {
$create_account = 1; $create_account = 1;
self::$smarty->assign('email_create', 1); self::$smarty->assign('email_create', 1);
} }
if(Tools::isSubmit('SubmitCreate')) { if (Tools::isSubmit('SubmitCreate')) {
$create_account = 1; $create_account = 1;
self::$smarty->assign('email_create', Tools::safeOutput($email)); 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; $create_account = 1;
if(Tools::isSubmit('submitAccount')) if(Tools::isSubmit('submitAccount')) {
self::$smarty->assign('email_create', 1); self::$smarty->assign('email_create', 1);
/* New Guest customer */ }
if(!Tools::getValue('is_new_customer', 1) && !Configuration::get('PS_GUEST_CHECKOUT_ENABLED')) {
/* 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.'); $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_); $_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 */ /** @Override Antadis - mail fixing */
$_POST['email'] = str_replace(array('@hotmil.','@htmail.','@hotmal.','@hotml.','@hotmai.'),'@hotmail.',$_POST['email']); $email = str_replace(array('@hotmil.','@htmail.','@hotmal.','@hotml.','@hotmai.'),'@hotmail.', $email);
$_POST['email'] = str_replace(array('@gmal.','@gail.','@gml.','@gmai.','@gmil.'),'@gmail.',$_POST['email']); $email = str_replace(array('@gmal.','@gail.','@gml.','@gmai.','@gmil.'),'@gmail.', $email);
$_POST['email'] = str_replace('@gmailcom','@gmail.com',$_POST['email']); $email = str_replace('@gmailcom','@gmail.com', $email);
$_POST['email'] = str_replace('@hotmailcom','@hotmail.com',$_POST['email']); $email = str_replace('@hotmailcom','@hotmail.com', $email);
$_POST['email'] = str_replace('@hotmailfr','@hotmail.fr',$_POST['email']); $email = str_replace('@hotmailfr','@hotmail.fr', $email);
/** @End Override Antadis - mail fixing */ /** @End Override Antadis - mail fixing */
/* Preparing customer */ /* Preparing customer */
@ -133,7 +140,7 @@ class AuthController extends AuthControllerCore {
$_POST['firstname'] = $firstnameAddress; $_POST['firstname'] = $firstnameAddress;
if(!sizeof($this->errors)) { 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.'); $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')) {