Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

DRY it up.

  • Loading branch information...
commit f7ce8994e65c4ee7744588900d6092924209265e 1 parent d01cdb4
@jaredhanson authored
Showing with 9 additions and 10 deletions.
  1. +9 −10 lib/passport-http/strategies/basic.js
View
19 lib/passport-http/strategies/basic.js
@@ -84,18 +84,17 @@ BasicStrategy.prototype.authenticate = function(req) {
}
var self = this;
+
+ function verified(err, user) {
+ if (err) { return self.error(err); }
+ if (!user) { return self.fail(self._challenge()); }
+ self.success(user);
+ }
+
if (self._passReqToCallback) {
- this._verify(req, userid, password, function(err, user) {
- if (err) { return self.error(err); }
- if (!user) { return self.fail(self._challenge()); }
- self.success(user);
- });
+ this._verify(req, userid, password, verified);
} else {
- this._verify(userid, password, function(err, user) {
- if (err) { return self.error(err); }
- if (!user) { return self.fail(self._challenge()); }
- self.success(user);
- });
+ this._verify(userid, password, verified);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.