Merge pull request #1128 from vishal-singh-webkul/gli-2032
Fixed: Admin is able to create account using 0 as email
This commit is contained in:
@@ -1044,22 +1044,27 @@ class AdminCustomersControllerCore extends AdminController
|
||||
$customer = new Customer();
|
||||
if (Validate::isEmail($customer_email)) {
|
||||
$customer->getByEmail($customer_email);
|
||||
}
|
||||
if ($customer->id) {
|
||||
$this->errors[] = Tools::displayError('An account already exists for this email address:').' '.$customer_email;
|
||||
if ($customer->id) {
|
||||
$this->errors[] = Tools::displayError('An account already exists for this email address:').' '.$customer_email;
|
||||
$this->display = 'edit';
|
||||
return $customer;
|
||||
} elseif (trim(Tools::getValue('passwd')) == '') {
|
||||
$this->validateRules();
|
||||
$this->errors[] = Tools::displayError('Password can not be empty.');
|
||||
$this->display = 'edit';
|
||||
} elseif ($customer = parent::processAdd()) {
|
||||
$this->context->smarty->assign('new_customer', $customer);
|
||||
return $customer;
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('Invalid email address.');
|
||||
$this->display = 'edit';
|
||||
return $customer;
|
||||
} elseif (trim(Tools::getValue('passwd')) == '') {
|
||||
$this->validateRules();
|
||||
$this->errors[] = Tools::displayError('Password can not be empty.');
|
||||
$this->display = 'edit';
|
||||
} elseif ($customer = parent::processAdd()) {
|
||||
$this->context->smarty->assign('new_customer', $customer);
|
||||
return $customer;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public function processUpdate()
|
||||
{
|
||||
if (Validate::isLoadedObject($this->object)) {
|
||||
@@ -1070,7 +1075,10 @@ class AdminCustomersControllerCore extends AdminController
|
||||
$customer = new Customer();
|
||||
if (Validate::isEmail($customer_email)) {
|
||||
$customer->getByEmail($customer_email);
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('Invalid email address.');
|
||||
}
|
||||
|
||||
if (($customer->id) && ($customer->id != (int)$this->object->id)) {
|
||||
$this->errors[] = Tools::displayError('An account already exists for this email address:').' '.$customer_email;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user