Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated: Password is no longer required while creating a customer from the back office. #1350

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions controllers/admin/AdminCustomersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,6 @@ public function renderForm()
'type' => 'password',
'label' => $this->l('Password'),
'name' => 'passwd',
'required' => ($obj->id ? false : true),
'col' => '4',
'hint' => ($obj->id ? $this->l('Leave this field blank if there\'s no change.') :
sprintf($this->l('Password should be at least %s characters long.'), Validate::PASSWORD_LENGTH))
Expand Down Expand Up @@ -1088,6 +1087,10 @@ public function processAdd()
// Check that the new email is not already in use
$customer_email = trim(strval(Tools::getValue('email')));
$customer = new Customer();
if (trim(Tools::getValue('passwd')) == '') {
$_POST['passwd'] = md5(time()._COOKIE_KEY_);
}

if (Validate::isEmail($customer_email)) {
$customer->getByEmail($customer_email);
if ($customer->id) {
Expand All @@ -1097,10 +1100,6 @@ public function processAdd()
} elseif (Customer::customerExists($customer_email, false, false)) {
$this->errors[] = Tools::displayError('The email is already associated with a banned account. Please use a different one.');
$this->display = 'edit';
} 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;
Expand Down