Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- app.post('/login, async function(req, res, next) {
- try {
- //Here I'm authenticating this users if
- //users exists and its pasword is correct.
- const userObj = await User.login(req.body);
- //If user verified we'll create a session
- //for this user by stroing it's information
- req.session.user = { email: userObj.email, name: userObj.name };
- res.redirect('/list');
- }catch(e) {
- next(e);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement