#[Route(path: '/store-api/account/recovery-password', name: 'store-api.account.recovery.send.mail', methods: ['POST'])]
public function sendRecoveryMail(RequestDataBag
$data, SalesChannelContext
$context, bool
$validateStorefrontUrl = true
): SuccessResponse
{ $this->
validateRecoverEmail($data,
$context,
$validateStorefrontUrl);
if (($request =
$this->requestStack->
getMainRequest()) !== null
) { $this->rateLimiter->
ensureAccepted(RateLimiter::RESET_PASSWORD,
strtolower($data->
get('email'
) . '-' .
$request->
getClientIp()));
} $customer =
$this->
getCustomerByEmail($data->
get('email'
),
$context);
$customerId =
$customer->
getId();
$customerIdCriteria =
new Criteria();
$customerIdCriteria->
addFilter(new EqualsFilter('customerId',
$customerId));
$customerIdCriteria->
addAssociation('customer.salutation'
);
$repoContext =
$context->
getContext();
$existingRecovery =
$this->customerRecoveryRepository->
search($customerIdCriteria,
$repoContext)->
first();
if ($existingRecovery instanceof CustomerRecoveryEntity
) { $this->
deleteRecoveryForCustomer($existingRecovery,
$repoContext);
}