diff --git a/src/Controller/Customer/LoggedInCustomerDetailsAction.php b/src/Controller/Customer/LoggedInCustomerDetailsAction.php index 26a40f0ba..63a7b7400 100644 --- a/src/Controller/Customer/LoggedInCustomerDetailsAction.php +++ b/src/Controller/Customer/LoggedInCustomerDetailsAction.php @@ -35,6 +35,10 @@ public function __construct( public function __invoke(Request $request): Response { + if (!$this->loggedInShopUserProvider->isUserLoggedIn()) { + return $this->viewHandler->handle(View::create(null, Response::HTTP_UNAUTHORIZED)); + } + $customer = $this->loggedInShopUserProvider->provide()->getCustomer(); Assert::notNull($customer); diff --git a/src/Controller/Customer/UpdateCustomerAction.php b/src/Controller/Customer/UpdateCustomerAction.php index 402f2cea2..9b75145d7 100644 --- a/src/Controller/Customer/UpdateCustomerAction.php +++ b/src/Controller/Customer/UpdateCustomerAction.php @@ -54,6 +54,10 @@ public function __construct( public function __invoke(Request $request): Response { + if (!$this->loggedInUserProvider->isUserLoggedIn()) { + return $this->viewHandler->handle(View::create(null, Response::HTTP_UNAUTHORIZED)); + } + $validationResults = $this->updateCustomerCommandProvider->validate($request, null, ['sylius_customer_profile_update']); if (0 !== count($validationResults)) { return $this->viewHandler->handle(View::create(