Hey,
I would like to create a login system in Express + Mongoose.
I managed to create in HTML some dummy page that reads as input an username and a password and send it using backbone to the server (express) that takes the input and search in the database for some entry with the same username and password (with mongoose).
Everything works fine up until here, now my question: how can I assure my user is connected? I mean, I could possibly redirect my user to another page now that I checked that the username and the password match, but I would like to have for example “Hello username” if the user is logged, or “login” if the user is not logged. In PHP would be really easy, but how to do that with Express?
Thanks
Masiar
Check out the express session support. When the user logs in you can set the user as a property of the session. In your template you can include the user’s name in the HTML if the session has an active user.