@@ -2,7 +2,7 @@ var authModel = require('../models/auth.server.model.js');
22
33
44exports . create = function ( req , res ) {
5- console . log ( authModel ) ;
5+ // console.log(authModel);
66 // var newAuth = new authModel({
77 // email: req.body.email,
88 // firstName: req.body.firstName,
@@ -29,19 +29,19 @@ exports.create = function(req, res){
2929 } ) ;
3030 } )
3131} ;
32- exports . fetch = function ( email , password , done ) {
32+ exports . fetch = function ( req , email , password , done ) {
3333 authModel . findOne ( { email :email } , function ( err , user ) {
3434 // if there are any errors, return the error before anything else
3535 if ( err )
3636 return done ( err ) ;
3737
3838 // if no user is found, return the message
3939 if ( ! user )
40- return done ( null , false , req . flash ( 'loginMessage' , 'No user found.' ) ) ; // req.flash is the way to set flashdata using connect-flash
40+ return done ( null , false ) ; // req.flash is the way to set flashdata using connect-flash
4141
4242 // if the user is found but the password is wrong
4343 if ( ! user . validPassword ( password ) )
44- return done ( null , false , req . flash ( 'loginMessage' , 'Oops! Wrong password.' ) ) ; // create the loginMessage and save it to session as flashdata
44+ return done ( null , false ) ; // create the loginMessage and save it to session as flashdata
4545
4646 // all is well, return successful user
4747 return done ( null , user ) ;
0 commit comments