Skip to content

Commit 505e258

Browse files
authored
Set isSecureArea before deleting customer
Deletion of the customer is only possible if isSecureArea is true. If it is not set deletion will fail with an exception and the customer will not know why the registration failed and will not be able to register again due to the existing entity.
1 parent 7e0fc6b commit 505e258

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

app/code/Magento/Customer/Model/AccountManagement.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,15 @@ public function createAccountWithPasswordHash(CustomerInterface $customer, $hash
943943
}
944944
$this->customerRegistry->remove($customer->getId());
945945
} catch (InputException $e) {
946+
$originalValue = $this->registry->registry('isSecureArea');
947+
$this->registry->unregister('isSecureArea');
948+
$this->registry->register('isSecureArea', true);
949+
946950
$this->customerRepository->delete($customer);
951+
952+
$this->registry->unregister('isSecureArea');
953+
$this->registry->register('isSecureArea', $originalValue);
954+
947955
throw $e;
948956
}
949957
$customer = $this->customerRepository->getById($customer->getId());

0 commit comments

Comments
 (0)