1
0
mirror of https://github.com/flarum/core.git synced 2025-07-28 12:10:51 +02:00

Allow setting the token lifetime

This commit is contained in:
Toby Zerner
2016-01-02 15:22:53 +10:30
parent b3b7ed71fa
commit 910fdcfac7

View File

@@ -57,6 +57,7 @@ class TokenController implements ControllerInterface
$identification = array_get($body, 'identification'); $identification = array_get($body, 'identification');
$password = array_get($body, 'password'); $password = array_get($body, 'password');
$lifetime = array_get($body, 'lifetime', 3600);
$user = $this->users->findByIdentification($identification); $user = $this->users->findByIdentification($identification);
@@ -64,7 +65,7 @@ class TokenController implements ControllerInterface
throw new PermissionDeniedException; throw new PermissionDeniedException;
} }
$token = AccessToken::generate($user->id); $token = AccessToken::generate($user->id, $lifetime);
$token->save(); $token->save();
return (new JsonResponse([ return (new JsonResponse([