Skip to content

Commit 4e9c821

Browse files
authored
considering users who disable CSRF protection for Symfony
User can disable CSRF protection globally in the framework via `framework.csrf_protection.enabled: false`
1 parent f225383 commit 4e9c821

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Controller/SecurityController.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ public function loginAction(Request $request)
5454
// last username entered by the user
5555
$lastUsername = (null === $session) ? '' : $session->get($lastUsernameKey);
5656

57-
$csrfToken = $this->get('security.csrf.token_manager')->getToken('authenticate')->getValue();
57+
$csrfToken = $this->has('security.csrf.token_manager')
58+
? $this->get('security.csrf.token_manager')->getToken('authenticate')->getValue()
59+
: null;
5860

5961
return $this->renderLogin(array(
6062
'last_username' => $lastUsername,

0 commit comments

Comments
 (0)