Skip to content

Commit

Permalink
Handle email/password login attempts for accounts with no password.
Browse files Browse the repository at this point in the history
  • Loading branch information
YasharF committed Jul 28, 2019
1 parent 61f89bf commit a945334
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config/passport.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ passport.use(new LocalStrategy({ usernameField: 'email' }, (email, password, don
if (!user) {
return done(null, false, { msg: `Email ${email} not found.` });
}
if (!user.password) {
return done(null, false, { msg: 'Your account was registered using a sign-in provider. To enable password login, sign in using a provider, and then set a password under your user profile.' });
}
user.comparePassword(password, (err, isMatch) => {
if (err) { return done(err); }
if (isMatch) {
Expand Down

0 comments on commit a945334

Please sign in to comment.