mirror of
https://github.com/flarum/framework.git
synced 2024-12-05 09:03:36 +08:00
Extend social login access token expiry
This commit is contained in:
parent
a602790cb0
commit
af1ac1ef42
|
@ -14,6 +14,7 @@ use Flarum\Core\Users\User;
|
|||
use Zend\Diactoros\Response\HtmlResponse;
|
||||
use Flarum\Api\Commands\GenerateAccessToken;
|
||||
use Flarum\Core\Users\AuthToken;
|
||||
use DateTime;
|
||||
|
||||
trait AuthenticatorTrait
|
||||
{
|
||||
|
@ -71,6 +72,11 @@ window.close();
|
|||
$response = new HtmlResponse($content);
|
||||
|
||||
if (isset($accessToken)) {
|
||||
// Extend the token's expiry to 2 weeks so that we can set a
|
||||
// remember cookie
|
||||
$accessToken::unguard();
|
||||
$accessToken->update(['expires_at' => new DateTime('+2 weeks')]);
|
||||
|
||||
$response = $this->withRememberCookie($response, $accessToken->id);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user