#274 save last login date

This commit is contained in:
Avris 2021-11-23 14:44:24 +01:00
parent 0f5865e4dd
commit 70e4b9e214
2 changed files with 9 additions and 0 deletions

View File

@ -0,0 +1,6 @@
-- Up
ALTER TABLE users ADD COLUMN lastActive INTEGER NULL;
-- Down

View File

@ -176,6 +176,9 @@ const reloadUser = async (req, res, next) => {
return;
}
console.log('reloadUser');
await req.db.get(SQL`UPDATE users SET lastActive = ${+new Date} WHERE id = ${req.user.id}`);
if (req.user.username !== dbUser.username
|| req.user.email !== dbUser.email
|| req.user.roles !== dbUser.roles