diff --git a/classes/Context.php b/classes/Context.php index 8ce001d4471..a4c66f570a1 100644 --- a/classes/Context.php +++ b/classes/Context.php @@ -359,6 +359,8 @@ public function updateCustomer(Customer $customer) $this->cookie->id_cart = (int) $this->cart->id; $this->cookie->write(); $this->cart->autosetProductAddress(); + + $this->cookie->registerSession(new CustomerSession()); } /** diff --git a/classes/form/CustomerLoginForm.php b/classes/form/CustomerLoginForm.php index 2e4368d0bd7..a5e26ecaf32 100644 --- a/classes/form/CustomerLoginForm.php +++ b/classes/form/CustomerLoginForm.php @@ -71,7 +71,6 @@ public function submit() $this->errors[''][] = $this->translator->trans('Authentication failed.', [], 'Shop.Notifications.Error'); } else { $this->context->updateCustomer($customer); - $this->context->cookie->registerSession(new CustomerSession()); Hook::exec('actionAuthentication', ['customer' => $this->context->customer]); diff --git a/classes/form/CustomerPersister.php b/classes/form/CustomerPersister.php index ba4a1328745..2b7815c429d 100644 --- a/classes/form/CustomerPersister.php +++ b/classes/form/CustomerPersister.php @@ -55,9 +55,9 @@ public function save(Customer $customer, $clearTextPassword, $newPassword = '', { if ($customer->id) { return $this->update($customer, $clearTextPassword, $newPassword, $passwordRequired); - } else { - return $this->create($customer, $clearTextPassword); } + + return $this->create($customer, $clearTextPassword); } private function update(Customer $customer, $clearTextPassword, $newPassword, $passwordRequired = true)