Guest User

Untitled

a guest
Mar 5th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. router.post('/getlogin', function (req, res) {
  2. username = req.body.username;
  3. password = req.body.password;
  4.  
  5. adminlogin = database.ref('booths');
  6.  
  7. adminlogin.once('value', function(snapshot){
  8. var dataSet = [];
  9. snapshot.forEach(function(childsnapshot){
  10.  
  11. user = childsnapshot.val().username;
  12. pass = childsnapshot.val().password;
  13. if(username == user){
  14. req.session.user = childsnapshot.key;
  15. req.session.auth = true;
  16. return res.status(200).send('Success');
  17. }else{
  18.  
  19. return res.status(401).send('false');
  20. }
  21. });
  22.  
  23. })
  24. })
Add Comment
Please, Sign In to add comment