Skip to content

Commit 4e3570c

Browse files
author
Zoltán Takács
committed
Hotfix
1 parent 3fac1f5 commit 4e3570c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/login/renew.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = (req, res) => {
66
let userId = null;
77

88
try {
9-
userId = jwt.verify(token, 'almafa').userId;
9+
userId = jwt.verify(prevJwt, 'almafa').userId;
1010
} catch {
1111
throw new Error('Unauthorized|401|UNAUTHORIZED');
1212
}
@@ -17,7 +17,9 @@ module.exports = (req, res) => {
1717
throw new Error('The resource could not be found.|404|NOT_FOUND');
1818
}
1919

20-
const token = jwt.sign({ userId: me.id }, 'almafa');
20+
const token = jwt.sign({ userId: me.id }, 'almafa', {
21+
expiresIn: '30 days'
22+
});
2123

2224
return res.send({ token, me });
2325
};

src/middlewares/auth.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const auth = (req, res, next) => {
2424

2525
const checkPermission = permission => (req, res, next) => {
2626
if (!req.user.permissions.includes(permission)) {
27-
throw new Error('You have no permission for that!|403|FORBIDDEN');
27+
throw new Error('Permission denied|403|FORBIDDEN');
2828
}
2929

3030
next();

0 commit comments

Comments
 (0)