Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 355
Nav Singh Avatar asked Jan 21 '26 18:01

Nav Singh


1 Answers

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.

like image 59
yeya Avatar answered Jan 24 '26 16:01

yeya



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!