Skip to content

Commit

Permalink
fix csrf token generation in LoginController loginAction (#437)
Browse files Browse the repository at this point in the history
first check, if csrf token is still, otherwise regnerate with force = true
  • Loading branch information
melissakittl authored Jul 2, 2024
1 parent cfc797e commit b945f8f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Controller/Admin/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ public function loginAction(
return new RedirectResponse($redirectUrl);
}

$csrfProtection->regenerateCsrfToken($request->getSession());
// check csrf token before generating a new one with force=true
if (!$csrfProtection->getCsrfToken($request->getSession())) {
$csrfProtection->regenerateCsrfToken($request->getSession());
}

$user = $this->getUser();
if ($user instanceof UserInterface) {
Expand Down

0 comments on commit b945f8f

Please sign in to comment.