SHARE
TWEET

auth

a guest Dec 12th, 2014 4 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. exports.authenticate = function(app) {
  2.   return function(req, res, next) {
  3.     passport.authenticate('local', function(err, user, info) {
  4.       if (err) { return next(err) }
  5.       if (!user) {
  6.         return res.send(401);
  7.       }
  8.       req.logIn(user, function(err) {
  9.         if (err) { return next(err); }
  10.         return res.send(200);
  11.       });
  12.     })(req, res, next);
  13.   }
  14. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top