From ec5de408b2454dd84477742b148025fd1a281761 Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Wed, 30 Oct 2019 12:38:14 +0200 Subject: [PATCH] Blank screen (JWT token expiration) bugfix --- monkey/monkey_island/cc/ui/src/services/AuthService.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/monkey/monkey_island/cc/ui/src/services/AuthService.js b/monkey/monkey_island/cc/ui/src/services/AuthService.js index 9c62bde63..ec997da6a 100644 --- a/monkey/monkey_island/cc/ui/src/services/AuthService.js +++ b/monkey/monkey_island/cc/ui/src/services/AuthService.js @@ -7,6 +7,8 @@ export default class AuthService { "55e97c9dcfd22b8079189ddaeea9bce8125887e3237b800c6176c9afa80d2062" + "8d2c8d0b1538d2208c1444ac66535b764a3d902b35e751df3faec1e477ed3557"; + SECONDS_BEFORE_JWT_EXPIRES = 20; + login = (username, password) => { return this._login(username, this.hashSha3(password)); }; @@ -96,7 +98,7 @@ export default class AuthService { _isTokenExpired(token) { try { - return decode(token)['exp'] < Date.now() / 1000; + return decode(token)['exp'] + this.SECONDS_BEFORE_JWT_EXPIRES < Date.now() / 1000; } catch (err) { return false;