Skip to content

Commit 78c9f37

Browse files
committed
REC-208: Vencimiento de sesión
1 parent 566016f commit 78c9f37

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/controllers/auth.controller.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,8 @@ class AuthController {
309309
usrn: user.username,
310310
bsname: user.businessName,
311311
rl: roles,
312-
iat: new Date().getTime()
312+
iat: moment().unix(),
313+
exp: moment().add((process.env.TOKEN_LIFETIME || env.TOKEN_LIFETIME || 12), 'hours').unix()
313314
}, (process.env.JWT_SECRET || env.JWT_SECRET), {
314315
algorithm: 'HS256'
315316
});
@@ -328,8 +329,8 @@ class AuthController {
328329
usrn: username,
329330
bsname: businessName,
330331
rl: role,
331-
iat: new Date().getTime(),
332-
exp: new Date().setDate(new Date().getDate() + env.TOKEN_LIFETIME)
332+
iat: moment().unix(),
333+
exp: moment().add((process.env.TOKEN_LIFETIME || env.TOKEN_LIFETIME || 12), 'hours').unix()
333334
}, (process.env.JWT_SECRET || env.JWT_SECRET), {
334335
algorithm: 'HS256'
335336
});

0 commit comments

Comments
 (0)