Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. app.post('/login, async function(req, res, next) {
  2. try {
  3. //Here I'm authenticating this users if
  4. //users exists and its pasword is correct.
  5. const userObj = await User.login(req.body);
  6. //If user verified we'll create a session
  7. //for this user by stroing it's information
  8. req.session.user = { email: userObj.email, name: userObj.name };
  9. res.redirect('/list');
  10. }catch(e) {
  11. next(e);
  12. }
  13. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement