To be more specific: if i once enter wrong username-password, after that any new attempt with the correct username-password leads to authentication:false
My code:
passport.use(new LocalStrategy(
function(username, password , done) {
User.findOne({ username: username , password:password }, function(err, user) {
if (err) { return done(err); }
if (!user) {
console.log('cannot find username and password');
return done(null, false);
}
return done(null, user);
});
}
));
app.post('/login', function (req,res) {
passport.authenticate('local');
if(req.isAuthenticated()){
req.session.destroy();
res.redirect('/index_connected.html')
} else{
req.session.destroy();
res.redirect('/login.html?code=11820')
}
});
First thought that deleting previous session might work. But even adding ' req.session.destroy()', nothing new. Thanks in advance
via nick314
No comments:
Post a Comment