Guest User

Untitled

a guest
Jan 3rd, 2019
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. function authenticate(session, name, pass, callback) {
  2. var user = users[name];
  3.  
  4. if (!user) {
  5. return delayAuthenticationResponse(session, function() {
  6. callback(new Error('cannot find user'));
  7. });
  8. }
  9.  
  10. if (user.pass == hash(pass, user.salt)) {
  11. delete session.attempts;
  12. return callback(null, user);
  13. }
  14.  
  15. delayAuthenticationResponse(session, function() {
  16. callback(new Error('invalid password'));
  17. });
  18. }
Add Comment
Please, Sign In to add comment