😁
Edit History
I have managed to override without modifying the original class.
To do this, I have create a CustomerLoginForm.php file in the directory in override/classes/form with the following code inside:
<?php use Symfony\Component\Translation\TranslatorInterface; use PrestaShop\PrestaShop\Adapter\ServiceLocator; class CustomerLoginForm extends CustomerLoginFormCore { public function submit() { $context = Context::getContext(); if ($this->validate()) { Hook::exec('actionAuthenticationBefore'); $oldkey = "8cBGziikjAX7NwLcGc9WsdDgR7O7nOxiK9KxvWLV9ZBcE6JjCiZZvEVz"; $pass_old_type = md5($oldkey . $this->getValue('password')); try { /** @var \PrestaShop\PrestaShop\Core\Crypto\Hashing $crypto */ $crypto = ServiceLocator::get('\\PrestaShop\\PrestaShop\\Core\\Crypto\\Hashing'); } catch (CoreException $e) { return false; } $customer = new Customer(); $my_customer_values = $customer->getByEmail($this->getValue('email')); $passwordHash = $my_customer_values->passwd; if ($pass_old_type === $passwordHash) { $customer->passwd = $crypto->hash($this->getValue('password'), _COOKIE_KEY_); $ok = Db::getInstance()->update('customer', array( 'passwd' => $customer->passwd), '`id_customer` = '.(int)$customer->id); } $customer = new Customer(); $authentication = $customer->getByEmail( $this->getValue('email'), $this->getValue('password') ); if (isset($authentication->active) && !$authentication->active) { $this->errors[''][] = $this->translator->trans('Your account isn\'t available at this time, please contact us', [], 'Shop.Notifications.Error'); } elseif (!$authentication || !$customer->id || $customer->is_guest) { $this->errors[''][] = $this->translator->trans('Authentication failed.', [], 'Shop.Notifications.Error'); } else { $this->context->updateCustomer($customer); Hook::exec('actionAuthentication', ['customer' => $this->context->customer]); // Login information have changed, so we check if the cart rules still apply CartRule::autoRemoveFromCart($this->context); CartRule::autoAddToCart($this->context); } } return !$this->hasErrors(); } }
Before it didn't work for me because it didn't include this: use Symfony\Component\Translation\TranslatorInterface;
😁