Merge pull request #1017 from vishal-singh-webkul/gli-1373

Updated error message for guest account while transforming to customer account
This commit is contained in:
Rohit Jain
2024-05-13 19:38:48 +05:30
committed by GitHub
2 changed files with 6 additions and 3 deletions

View File

@@ -92,10 +92,11 @@ class GuestTrackingControllerCore extends FrontController
$customer = new Customer((int)$order->id_customer);
if (!Validate::isLoadedObject($customer)) {
$this->errors[] = Tools::displayError('Invalid customer');
} elseif (!Tools::getValue('password')) {
} elseif (!Tools::getValue('password')
|| !Validate::isPasswd(Tools::getValue('password')
)) {
$this->errors[] = Tools::displayError('Invalid password.');
} elseif (!$customer->transformToCustomer($this->context->language->id, Tools::getValue('password'))) {
// @todo clarify error message
$this->errors[] = Tools::displayError('An error occurred while transforming a guest into a registered customer.');
} else {
$this->context->smarty->assign('transformSuccess', true);

View File

@@ -173,7 +173,9 @@ class OrderOpcControllerCore extends ParentOrderController
if (!count($this->errors)) {
$customer = new Customer($this->context->customer->id);
if ($customer->transformToCustomer($this->context->language->id, $passwd)) {
if (!$customer->isGuest()) {
$this->errors[] = Tools::displayError('This account is already registered as a customer.');
} else if ($customer->transformToCustomer($this->context->language->id, $passwd)) {
$this->context->updateCustomer($customer);
} else {
$this->errors[] = Tools::displayError('An error occurred while transforming your account into a registered customer.');