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