For the route /moderator/
I need to check if the user is already authenticated. If the user is authenticated, I need to redirect the user to /moderator/index.html
. If the user is not authenticated, I need to redirect the user to /moderator/login.html
.
I have been reading documentation but could not get enough from it.
So, the login.html
page has a form containing username and password field and the route for this (the form)
has been defined as follows:
this.router.post('/login/:usertype', passport.authenticate('local-user')
,(req, resp) =>
{
// Verified!!
});
I also read a post here at SO, but won't the request object change with a new request?
PS: I am not using any session module till now.
via Suhail Gupta
No comments:
Post a Comment