jaredhanson / passport-local

Username and password authentication strategy for Passport and Node.js.
https://www.passportjs.org/packages/passport-local/?utm_source=github&utm_medium=referral&utm_campaign=passport-local&utm_content=about
MIT License
2.74k stars 498 forks source link

Remove early auth error when no user or pass #114

Open BanovMiroslav opened 9 years ago

BanovMiroslav commented 9 years ago

When not adding a user and pass, there is a specific error being sent. But this case is already handled by the verify callback, and it is easier and more natural to send a prettier error response to the end-user if there is no special handling of the case where user and password are not provided.

Fonger commented 8 years ago

@jaredhanson

+1 for this. This is obviously a bug! jaredhanson/passport#466

However I think you should simply use this.error instead of removing it in this line: https://github.com/jaredhanson/passport-local/blob/master/lib/strategy.js#L75

vuaru commented 8 years ago

@Fonger Then you're assuming that not having a username or password is an error, which might not always be the case. Determining this is the job of the verify callback, imo.

rwky commented 6 years ago

@BanovMiroslav if you make a PR against https://github.com/passport-next/passport-local this will get looked into.