Skip to content

Commit 06c9c9d

Browse files
authored
Merge pull request #3 from RedTurtle/console-log
2 parents d06a1b6 + 8e82651 commit 06c9c9d

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/index.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,14 @@ const applyConfig = (config) => {
4444
// - header user is different from token user
4545
// - token has no expiration
4646
// - token is expired
47-
console.log("USER: ", user);
48-
console.log("TOKEN: ", jwtDecode(token));
49-
console.log("TOKEN SCADUTO: ", jwtDecode(token).exp < Date.now() / 1000);
50-
console.log("CONDIZIONE: ", ((user && jwtDecode(token).sub !== user) || !jwtDecode(token).exp || jwtDecode(token).exp < Date.now() / 1000));
51-
if ((user && jwtDecode(token).sub !== user) || !jwtDecode(token).exp || jwtDecode(token).exp < Date.now() / 1000){
47+
if (
48+
(user && jwtDecode(token).sub !== user) ||
49+
!jwtDecode(token).exp ||
50+
jwtDecode(token).exp < Date.now() / 1000
51+
) {
5252
// TODO: eventually add base_url to a relative settings.loginUrl
5353
return res.redirect(`${settings.loginUrl}?came_from=${req.url}`);
5454
}
55-
5655
}
5756
}
5857
return next();

0 commit comments

Comments
 (0)