Change login handling to automatically redirect a user if their session will need renewal.
This commit is contained in:
parent
24bb8da43d
commit
e7faf979a1
8 changed files with 126 additions and 23 deletions
|
@ -155,13 +155,15 @@ abstract class AbstractLoginController extends Controller
|
|||
*/
|
||||
protected function createJsonWebToken(User $user): string
|
||||
{
|
||||
$now = Chronos::now('utc');
|
||||
|
||||
$token = $this->builder
|
||||
->setIssuer('Pterodactyl Panel')
|
||||
->setAudience(config('app.url'))
|
||||
->setId(str_random(16), true)
|
||||
->setIssuedAt(Chronos::now()->getTimestamp())
|
||||
->setNotBefore(Chronos::now()->getTimestamp())
|
||||
->setExpiration(Chronos::now()->addSeconds(config('session.lifetime'))->getTimestamp())
|
||||
->setIssuedAt($now->getTimestamp())
|
||||
->setNotBefore($now->getTimestamp())
|
||||
->setExpiration($now->addSeconds(config('jwt.lifetime'))->getTimestamp())
|
||||
->set('user', (new AccountTransformer())->transform($user))
|
||||
->sign($this->getJWTSigner(), $this->getJWTSigningKey())
|
||||
->getToken();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue