mirror of
https://github.com/flarum/framework.git
synced 2025-01-20 18:27:47 +08:00
Allow setting the token lifetime
This commit is contained in:
parent
07a20a10fd
commit
6de7038f83
|
@ -57,6 +57,7 @@ class TokenController implements ControllerInterface
|
|||
|
||||
$identification = array_get($body, 'identification');
|
||||
$password = array_get($body, 'password');
|
||||
$lifetime = array_get($body, 'lifetime', 3600);
|
||||
|
||||
$user = $this->users->findByIdentification($identification);
|
||||
|
||||
|
@ -64,7 +65,7 @@ class TokenController implements ControllerInterface
|
|||
throw new PermissionDeniedException;
|
||||
}
|
||||
|
||||
$token = AccessToken::generate($user->id);
|
||||
$token = AccessToken::generate($user->id, $lifetime);
|
||||
$token->save();
|
||||
|
||||
return (new JsonResponse([
|
||||
|
|
Loading…
Reference in New Issue
Block a user