Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function authenticate(session, name, pass, callback) {
- var user = users[name];
- if (!user) {
- return delayAuthenticationResponse(session, function() {
- callback(new Error('cannot find user'));
- });
- }
- if (user.pass == hash(pass, user.salt)) {
- delete session.attempts;
- return callback(null, user);
- }
- delayAuthenticationResponse(session, function() {
- callback(new Error('invalid password'));
- });
- }
Add Comment
Please, Sign In to add comment