您好我在使用护照和mongodb的节点中进行登录本地会话,我收到了一个synthax错误,但我无法弄清楚原因?
这是一种奇怪的原因,我认为我得到了所有的东西
var localStrategy = require('passport-local').Strategy;
var User = require('../app/models/users');
module.exports = function(passport){
//Serializing user
passport.serializeUser(function(user,done){
done(null, user.id);
});
passport.deserializeUser(function(id,done){
User.findById(id, fuction(err,user){ //here it's the error D:
done(err,user);
});
});
passport.use('local-signup', new localStrategy({
usernameField: 'username',
passField:'pass'
passReqToCallback: true
},
function(req,username, pass, done){
process.nextTick(function(){
User.findOne({'local.emial':email,},function(err,user){
if(err){
return done(err);
}
if(user){
retrun done(null,false,req.flash('signupMessage','Thath email its already taken '));
}else{
var newUser = new User();
newUser.local.username = username;
newUser.local.pass = pass;
newUser.save(function(err){
if(err){
throw err;
return done(null,newUser);
}
})
}
});
});
}
));
// end function
}

答案 0 :(得分:0)
将fuction
更正为function
?