diff --git a/Config/module.xml b/Config/module.xml index 2e9d29e..133a05c 100644 --- a/Config/module.xml +++ b/Config/module.xml @@ -1,6 +1,5 @@ - OpenApi\OpenApi @@ -20,7 +19,7 @@ en_US fr_FR - 2.2.11 + 2.2.12 Vincent Lopes-Vicente diff --git a/Controller/Front/AuthController.php b/Controller/Front/AuthController.php index fc22d94..47032d8 100644 --- a/Controller/Front/AuthController.php +++ b/Controller/Front/AuthController.php @@ -88,17 +88,17 @@ public function customerLogin( $customer = CustomerQuery::create() ->filterByEmail($data['email']) - ->findOne() - ; + ->findOne(); if ($customer === null || !$customer->checkPassword($data['password'])) { - throw new \Exception(Translator::getInstance()->trans('Your username/password pair, does not correspond to any account', [], OpenApi::DOMAIN_NAME)); + throw new \Exception(Translator::getInstance()->trans('Your username/password pair, does not correspond to any account', + [], OpenApi::DOMAIN_NAME)); } $dispatcher->dispatch(new CustomerLoginEvent($customer), TheliaEvents::CUSTOMER_LOGIN); /* If the rememberMe property is set to true, we create a new cookie to store the information */ - if (true === (bool) $data['rememberMe']) { + if (true === (bool)$data['rememberMe']) { (new CookieTokenProvider())->createCookie( $customer, ConfigQuery::read('customer_remember_me_cookie_name', 'crmcn'), @@ -108,7 +108,7 @@ public function customerLogin( /** @var OpenApiCustomer $openApiCustomer */ $openApiCustomer = $modelFactory->buildModel('Customer', $customer); - $openApiCustomer->setDefaultAddressId($customer->getDefaultAddress()->getId()); + $openApiCustomer->setDefaultAddressId($customer->getDefaultAddress()?->getId()); return OpenApiService::jsonResponse($openApiCustomer); } diff --git a/Model/Api/Customer.php b/Model/Api/Customer.php index 96a5397..93d8da7 100644 --- a/Model/Api/Customer.php +++ b/Model/Api/Customer.php @@ -116,7 +116,7 @@ class Customer extends BaseApiModel public function createFromTheliaModel($theliaModel, $locale = null): void { parent::createFromTheliaModel($theliaModel, $locale); - $this->setDefaultAddressId($theliaModel->getDefaultAddress()->getId()); + $this->setDefaultAddressId($theliaModel->getDefaultAddress()?->getId()); } /**