CS
This commit is contained in:
parent
b67de1c311
commit
0d6e609448
@ -139,7 +139,7 @@ class AuthController extends AuthControllerCore
|
||||
$_POST['lastname'] = $lastnameAddress;
|
||||
$_POST['firstname'] = $firstnameAddress;
|
||||
|
||||
if(!sizeof($this->errors)) {
|
||||
if (!sizeof($this->errors)) {
|
||||
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.');
|
||||
}
|
||||
@ -150,15 +150,15 @@ class AuthController extends AuthControllerCore
|
||||
|
||||
$customer->birthday = (empty($_POST['years'])? '': (int)($_POST['years']).'-'.(int)($_POST['months']).'-'.(int)($_POST['days']));
|
||||
|
||||
if(!sizeof($this->errors)) {
|
||||
if (!sizeof($this->errors)) {
|
||||
$customer->active = 1;
|
||||
/* New Guest customer */
|
||||
if(Tools::isSubmit('is_new_customer')) {
|
||||
if (Tools::isSubmit('is_new_customer')) {
|
||||
$customer->is_guest = !Tools::getValue('is_new_customer', 1);
|
||||
} else {
|
||||
$customer->is_guest = 0;
|
||||
}
|
||||
if(!$customer->add()) {
|
||||
if (!$customer->add()) {
|
||||
$this->errors[] = Tools::displayError('An error occurred while creating your account.');
|
||||
} else {
|
||||
if(!$customer->is_guest) {
|
||||
@ -195,7 +195,7 @@ class AuthController extends AuthControllerCore
|
||||
'_POST' => $_POST,
|
||||
'newCustomer' => $customer
|
||||
));
|
||||
if(Tools::isSubmit('ajax')) {
|
||||
if (Tools::isSubmit('ajax')) {
|
||||
$return = array(
|
||||
'hasError' => !empty($this->errors),
|
||||
'errors' => $this->errors,
|
||||
@ -207,7 +207,7 @@ class AuthController extends AuthControllerCore
|
||||
);
|
||||
die(Tools::jsonEncode($return));
|
||||
}
|
||||
if($back = Tools::getValue('back')) {
|
||||
if ($back = Tools::getValue('back')) {
|
||||
if($back == '/') {
|
||||
$back = '/index.php?validation=1';
|
||||
Tools::redirect($back);
|
||||
@ -218,7 +218,8 @@ class AuthController extends AuthControllerCore
|
||||
}
|
||||
}
|
||||
}
|
||||
if(sizeof($this->errors)) {
|
||||
|
||||
if (sizeof($this->errors)) {
|
||||
if(!Tools::getValue('is_new_customer')) {
|
||||
unset($_POST['passwd']);
|
||||
}
|
||||
@ -234,7 +235,7 @@ class AuthController extends AuthControllerCore
|
||||
}
|
||||
}
|
||||
|
||||
if(Tools::isSubmit('SubmitLogin')) {
|
||||
if (Tools::isSubmit('SubmitLogin')) {
|
||||
Module::hookExec('beforeAuthentication');
|
||||
$passwd = trim(Tools::getValue('passwd'));
|
||||
$email = trim(Tools::getValue('email'));
|
||||
@ -251,7 +252,7 @@ class AuthController extends AuthControllerCore
|
||||
} else {
|
||||
$customer = new Customer();
|
||||
$authentication = $customer->getByEmail(trim($email), trim($passwd));
|
||||
if(!$authentication || !$customer->id) {
|
||||
if (!$authentication || !$customer->id) {
|
||||
/* Handle brute force attacks */
|
||||
sleep(1);
|
||||
$this->errors[] = Tools::displayError('Authentication failed');
|
||||
@ -295,7 +296,7 @@ class AuthController extends AuthControllerCore
|
||||
}
|
||||
}
|
||||
}
|
||||
if(Tools::isSubmit('ajax')) {
|
||||
if (Tools::isSubmit('ajax')) {
|
||||
$return = array(
|
||||
'hasError' => !empty($this->errors),
|
||||
'errors' => $this->errors,
|
||||
@ -305,7 +306,7 @@ class AuthController extends AuthControllerCore
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($create_account)) {
|
||||
if (isset($create_account)) {
|
||||
/* Call a hook to display more information on form */
|
||||
self::$smarty->assign(array(
|
||||
'HOOK_CREATE_ACCOUNT_FORM' => Module::hookExec('createAccountForm'),
|
||||
@ -339,14 +340,16 @@ class AuthController extends AuthControllerCore
|
||||
self::$smarty->assign('newsletter', (int)Module::getInstanceByName('blocknewsletter')->active);
|
||||
}
|
||||
|
||||
public function displayContent() {
|
||||
public function displayContent()
|
||||
{
|
||||
Tools::safePostVars();
|
||||
self::$smarty->assign('errors', $this->errors);
|
||||
self::$smarty->assign('HOOK_CREATE_ACCOUNT_FORM_BOTTOM', Module::hookExec('createAccountFormBottom', array()));
|
||||
self::$smarty->display(_PS_THEME_DIR_.'authentication.tpl');
|
||||
}
|
||||
|
||||
public function setMedia() {
|
||||
public function setMedia()
|
||||
{
|
||||
parent::setMedia();
|
||||
|
||||
global $css_files;
|
||||
|
Loading…
Reference in New Issue
Block a user