How to check if user has logged-in for the first time?

烂漫一生 提交于 2019-12-11 13:18:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!