问题
I am using Node, Express, and MongoDB for my application. I am rendering Pug Template on server side and using Json Web Tokens for login.
I want to display a specific page when user logs in for the first time. Confused how to render it only one time.
Maybe adding a field like "accountStatus" and setting status to Active or Inactive will help?
回答1:
Save a last_login_time
field on DB, it can also be used later for other logic in your app.
If the field is empty (or not exist) display the specific page.
来源:https://stackoverflow.com/questions/58281277/how-to-check-if-user-has-logged-in-for-the-first-time