You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I was looking through the example code on everyauth.com and found this snippet
// findUser passes an error or user to a callback after finding the
// user by login
findUser( login, function (err, user) {
if (err) {
errors.push(err.message || err);
return promise.fulfill(errors);
}
if (!user) {
errors.push('User with login ' + login + ' does not exist.');
return promise.fulfill(errors);
}
bcrypt.compare(password, user.hash, function (err, didSucceed) {
if (err) {
return promise.fail(err);
errors.push('Wrong password.');
return promise.fulfill(errors);
}
if (didSucceed) return promise.fulfill(user);
errors.push('Wrong password.');
return promise.fulfill(errors);
});
});
The code after "return promise.fail(err);" won't be run. So that's confusing.
I'm new to NodeJS, but I didn't see how the login var was in scope in this line:
errors.push('User with login ' + login + ' does not exist.');
Anyways, this looks totally bad-ass and will save me a ton of time. Thanks for the work!
The text was updated successfully, but these errors were encountered:
Hi, I was looking through the example code on everyauth.com and found this snippet
errors.push('User with login ' + login + ' does not exist.');
Anyways, this looks totally bad-ass and will save me a ton of time. Thanks for the work!
The text was updated successfully, but these errors were encountered: