Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c713200

Browse files
committed
Fix RememberMe with null password
1 parent b4a63f9 commit c713200

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected function processAutoLoginCookie(array $cookieParts, Request $request)
5353
throw new \RuntimeException(sprintf('The UserProviderInterface implementation must return an instance of UserInterface, but returned "%s".', \get_class($user)));
5454
}
5555

56-
if (true !== hash_equals($this->generateCookieHash($class, $username, $expires, $user->getPassword()), $hash)) {
56+
if (true !== hash_equals($this->generateCookieHash($class, $username, $expires, $user->getPassword() ?? ''), $hash)) {
5757
throw new AuthenticationException('The cookie\'s hash is invalid.');
5858
}
5959

@@ -71,7 +71,7 @@ protected function onLoginSuccess(Request $request, Response $response, TokenInt
7171
{
7272
$user = $token->getUser();
7373
$expires = time() + $this->options['lifetime'];
74-
$value = $this->generateCookieValue(\get_class($user), $user->getUsername(), $expires, $user->getPassword());
74+
$value = $this->generateCookieValue(\get_class($user), $user->getUsername(), $expires, $user->getPassword() ?? '');
7575

7676
$response->headers->setCookie(
7777
new Cookie(

0 commit comments

Comments
 (0)