Passport js giving connection timeout error?
I have created an login session using passport local session but upon deploying it on server i'm getting an connection timeout error and here is my code of function:-
if(req.method=="POST")
{
passport.authenticate('local',{successRedirect:'/addjob',failureRedirect:'/adminlogin',failureFlash:false}),
function(req,res)
{
res.redirect('/addjob');
}
}
and this my passport configuration :-
passport.use(new LocalStratergy(function(User_id,password,done){
let query={user_id:user_id};
User.findOne(query,function(err,user){
if(err)throw err;
if(!user){
return done(null,false,{message:'User Not Found'});
}
bcrypt.compare(password,user.password,function(err,isMatch){
if(err)throw err;
if(isMatch)
{
return done(null,user);
}
else
{
return done(null,false,{message:'Wrong password'});
}
});
});
}));
and this the form from which data is captured :-
<form method="POST" action="/login">
<div class="form-group">
<input type="text" class="form-control" id="user_id" placeholder="User Id">
</div>
<div class="form-group">
<input type="password" class="form-control" id="password" placeholder="Passowrd">
</div>
<div class="form-group text-center">
<button type="sumbit" class="btn btn-primary"> Login</button>
<button type="sumbit" class="btn btn-primary"> Register</button>
</div>
</form>
</div>
can anyone tell me where iam going wrong and how can i correct it ?