Commit 73dcf1a8 authored by Leon's avatar Leon 😶

🐛 Une histoire de date

parent b8ce5ee2
Pipeline #12094 passed with stage
in 2 minutes and 15 seconds
......@@ -14,7 +14,8 @@ export const requireValidUser = (req, res, next) => {
if (!user) {
res.status(403).send('User logged in unknown');
} else {
if (token.passwordLastModifiedAt !== user.password_last_modified_at.toISOString()) {
const tokenDate = new Date(token.passwordLastModifiedAt);
if (tokenDate.toJSON() !== user.password_last_modified_at.toJSON()) {
res.status(403).send('Token has expired');
} else {
next();
......@@ -32,7 +33,7 @@ export const requireAdmin = (req, res, next) => {
if (token.role === 'admin') {
next();
} else {
res.status(403).send('Only admin can use this function');
res.status(403).send('Only admins can use this function');
}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment