Advertisement
Guest User

Untitled

a guest
Sep 16th, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. app.post('/authenticate_user', function(req, res){
  2. var mail = req.body.Mail;
  3. var password = req.body.Password;
  4. res.setHeader("Cache-Control", "private, no-cache, no-store, must-revalidate, max-age=0");
  5. var isValid=authenticate_user(mail, password);
  6. console.log("isValid-->"+isValid);
  7.  
  8. res.json(isValid);
  9. });
  10. var authenticate_user=function(mail, password){
  11. var query = user_details.find({'Mail': mail});
  12. query.exec( function(err, docs){
  13. if (docs.length==0) {
  14. return false;
  15. }
  16. else{
  17. return(docs[0].Password==password);
  18. }
  19. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement