@@ -0,0 +1,1881 @@
+// passport config%0A%0Avar localStrategy = require('passport-local');%0Avar User = require('../app/models/user');%0A%0A// exporting module%0Amodule.exports = function(passport) %7B%0A%0A    // used to serialize the user for the session%0A    passport.serializeUser(function(user, done) %7B%0A        done(null, user.id);%0A    %7D);%0A%0A    // used to deserialize the user%0A    passport.deserializeUser(function(id, done) %7B%0A        User.findById(id, function(err, user) %7B%0A            done(err, user);%0A        %7D);%0A    %7D);%0A%0A    passport.use('local-login', new LocalStrategy(%7B%0A            // by default, local strategy uses username and password, we will override with email%0A            usernameField: 'email',%0A            passwordField: 'password',%0A            passReqToCallback: true // allows us to pass in the req from our route (lets us check if a user is logged in or not)%0A        %7D,%0A        function(req, email, password, done) %7B%0A            if (email)%0A                email = email.toLowerCase(); // Use lower-case e-mails to avoid case-sensitive e-mail matching%0A%0A            // asynchronous%0A            process.nextTick(function() %7B%0A                User.findOne(%7B%0A                    'local.email': email%0A                %7D, function(err, user) %7B%0A                    // if there are any errors, return the error%0A                    if (err)%0A                        return done(err);%0A%0A                    // if no user is found, return the message%0A                    if (!user)%0A                        return done(null, false, req.flash('loginMessage', 'No user found.'));%0A%0A                    if (!user.validPassword(password))%0A                        return done(null, false, req.flash('loginMessage', 'Oops! Wrong password.'));%0A%0A                    // all is well, return user%0A                    else%0A                        return done(null, user);%0A                %7D);%0A            %7D);%0A%0A        %7D));%0A%7D;%0A

Edit passport.js