You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I run the sever is ok at the first time,but when I try to login after a time.That will be "POST /login 500 217.833 ms - 1355".My code:
passport.use(
'local-login',
new LocalStrategy({
// by default, local strategy uses username and password, we will override with email
usernameField : 'username',
passwordField : 'password',
passReqToCallback : true // allows us to pass back the entire request to the callback
},
function(req, username, password, done) { // callback with email and password from our form
connection.query("SELECT * FROM palcan_datacenter.user_tbl WHERE name = ?;",[username],function(err,rows){
if (err){
return done(err);
}
if (!rows.length) {
return done(null, false, req.flash('loginMessage', 'No user here.')); // req.flash is the way to set flashdata using connect-flash
}
// if the user is found but the password is wrong
if (!( rows[0].password == password)){
return done(null, false, req.flash('loginMessage', 'Passport is not correct.')); // create the loginMessage and save it to session as flashdata
}
var json={};
json.id=rows[0].uid;
json.name=rows[0].name;
json.password=rows[0].password;
return done(null, json);
});
})
);`
```
The text was updated successfully, but these errors were encountered:
I run the sever is ok at the first time,but when I try to login after a time.That will be "POST /login 500 217.833 ms - 1355".My code:
The text was updated successfully, but these errors were encountered: