Created
January 5, 2022 14:15
-
-
Save Xbirdfr/47f8c78e23c155f35ef0e9c3c5eae0d3 to your computer and use it in GitHub Desktop.
Symfony 5.4 - FormAuthenticator - Remember me Badge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // src\Security\FormAuthenticator.php | |
| // auto generated symfony cli | |
| //edit the file and add ' new RememberMeBadge(), ' into the 'new PasswordCredentials' array | |
| public function authenticate(Request $request): PassportInterface | |
| { | |
| $email = $request->request->get('email', ''); | |
| $request->getSession()->set(Security::LAST_USERNAME, $email); | |
| return new Passport( | |
| new UserBadge($email), | |
| new PasswordCredentials($request->request->get('password', '')), | |
| [ | |
| new CsrfTokenBadge('authenticate', $request->get('_csrf_token')), | |
| new RememberMeBadge(), | |
| ] | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment