Skip to content

Commit 89b98b3

Browse files
committed
Password reset response 503 is no email asuccess
1 parent 51b5d20 commit 89b98b3

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/Action/User/PasswordRequestAction.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,15 @@ public function __invoke(Request $request, string $username)
4747
return new Response(null, Response::HTTP_UNPROCESSABLE_ENTITY);
4848
}
4949

50+
$passwordResetSuccess = true;
5051
if ($user) {
5152
$this->entityManager->flush();
52-
$this->mailer->sendPasswordResetEmail($user);
53+
$passwordResetSuccess = $this->mailer->sendPasswordResetEmail($user);
5354
$user->setPasswordRequestedAt(new \DateTime());
5455
$this->entityManager->flush();
5556
}
5657

57-
$response = new Response(null, Response::HTTP_OK);
58+
$response = new Response(null, $passwordResetSuccess ? Response::HTTP_OK : Response::HTTP_SERVICE_UNAVAILABLE);
5859
$response->setCache([
5960
'private' => true,
6061
's_maxage' => 0,

0 commit comments

Comments
 (0)