Explicitly verifyWithUsername() and offer a verify() userId based

This commit is contained in:
Johannes Zellner
2016-04-05 16:27:04 +02:00
parent baf586b028
commit b205212bf2
4 changed files with 78 additions and 12 deletions
+2 -2
View File
@@ -44,7 +44,7 @@ function initialize(callback) {
passport.use(new LocalStrategy(function (username, password, callback) {
if (username.indexOf('@') === -1) {
user.verify(username, password, function (error, result) {
user.verifyWithUsername(username, password, function (error, result) {
if (error && error.reason === UserError.NOT_FOUND) return callback(null, false);
if (error && error.reason === UserError.WRONG_PASSWORD) return callback(null, false);
if (error) return callback(error);
@@ -74,7 +74,7 @@ function initialize(callback) {
return callback(null, client);
});
} else {
user.verify(username, password, function (error, result) {
user.verifyWithUsername(username, password, function (error, result) {
if (error && error.reason === UserError.NOT_FOUND) return callback(null, false);
if (error && error.reason === UserError.WRONG_PASSWORD) return callback(null, false);
if (error) return callback(error);