Last active
October 23, 2017 18:02
-
-
Save klinyecviktor/f4cbaa6fcaefb45fca7d835dbecc8f94 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
passport.use(new LocalStrategy((async (username, password, done) => { | |
try { | |
const user = await User.getUserByUsername(username); | |
if (!user) return done(null, false, { message: 'Unknown User' }); | |
const isMatch = await User.comparePassword(password, user.password) | |
if (isMatch) return done(null, userStore); | |
return done(null, false, { message: 'Invalid password' }); | |
} catch ({message}) { | |
console.error(message); | |
} | |
}))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment