Well i have simple form which check if username exists in users.
app.post('/api/checkUsernameAvail', function(req, res) {
console.log(req.user);
if(req.isAuthenticated()){
User.find(
{username: req.body.username.toLowerCase()},function(err, user){
if(user.length==0) var avail=true;
else var avail=false;
res.send(avail);
});
}else{
res.send(false);
}
});
After few requests, each time different count and different timeout, user automatically logged off. Not sure why, perhaps passport do something, but i am not sure how to fix this task. Have tried to not use req.isAuthenticated(), same result.
Aucun commentaire:
Enregistrer un commentaire