a guest Jul 20th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.'/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:, name: };
  9.           res.redirect('/list');
  10.         }catch(e) {
  11.           next(e);
  12.         }
  13.   });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand