1
0
mirror of https://github.com/flarum/core.git synced 2025-07-30 05:00:56 +02:00

No need to set a remember cookie if only logging in for session

This commit is contained in:
Toby Zerner
2017-10-07 17:51:30 +10:30
parent 2dbcfe02d8
commit 3b1f8771c4
2 changed files with 7 additions and 8 deletions

View File

@@ -24,7 +24,6 @@ class Rememberer
protected $cookie;
/**
* Rememberer constructor.
* @param CookieFactory $cookie
*/
public function __construct(CookieFactory $cookie)
@@ -32,18 +31,16 @@ class Rememberer
$this->cookie = $cookie;
}
public function remember(ResponseInterface $response, AccessToken $token, $session = false)
public function remember(ResponseInterface $response, AccessToken $token)
{
$lifetime = null;
if (! $session) {
$token->lifetime = $lifetime = 5 * 365 * 24 * 60 * 60; // 5 years
$token->save();
}
$token->lifetime = 5 * 365 * 24 * 60 * 60; // 5 years
$token->save();
return FigResponseCookies::set(
$response,
$this->cookie->make(self::COOKIE_NAME, $token->id, $lifetime)
$this->cookie->make(self::COOKIE_NAME, $token->id, $token->lifetime)
);
}