-
-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update last login time in database to fix issue #BB-311 #235
Update last login time in database to fix issue #BB-311 #235
Conversation
…r editor/user data at the time of login.
…profile same as MusicBrainz.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, that's a good fix, it's been bugging me for a while :)
src/server/routes/auth.js
Outdated
@@ -46,6 +46,13 @@ router.get('/cb', (req, res, next) => { | |||
return next(loginErr); | |||
} | |||
|
|||
const {Editor} = req.app.locals.orm; | |||
const lastLoginDate = new Date().toISOString(); | |||
(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how much I like self-invoking functions. I find they are confusing, especially for a beginner reading the code for the first time.
I would suggest to make the callback passed to .logIn asynchronous, and await
ing the Editor function calls.
In pseudo code, just to make sure I am clear:
return req.logIn(user, async (loginErr) => {
[...]
await Editor.where(XYZ).save(XYZ);
[...]
return res.redirect(redirectTo);
}
Thankyou @MonkeyDo for review, |
Great, thanks @akhilesh26, I'm glad to see this fixed ! |
Problem
The timestamp is same for Joined and Last Active in user's detail.
Solution
The database is updated for last login time.
Update label Last Active to Last login same as MusicBrainz.
Areas of Impact
Client-side:
src/client/components/pages/parts/editor-profile.js
Server-side:
src/server/routes/auth.js