mirror of
https://github.com/Permissionless-Software-Foundation/ipfs-bch-wallet-consumer.git
synced 2026-09-21 16:52:03 -07:00
linting
This commit is contained in:
+27
-22
@@ -22,27 +22,32 @@ passport.use(
|
||||
usernameField: 'email',
|
||||
passwordField: 'password'
|
||||
},
|
||||
async (email, password, done) => {
|
||||
try {
|
||||
const user = await User.findOne({ email })
|
||||
if (!user) {
|
||||
return done(null, false)
|
||||
}
|
||||
|
||||
try {
|
||||
const isMatch = await user.validatePassword(password)
|
||||
|
||||
if (!isMatch) {
|
||||
return done(null, false)
|
||||
}
|
||||
|
||||
done(null, user)
|
||||
} catch (err) {
|
||||
done(err)
|
||||
}
|
||||
} catch (err) {
|
||||
return done(err)
|
||||
}
|
||||
}
|
||||
passportCallback
|
||||
)
|
||||
)
|
||||
|
||||
async function passportCallback (email, password, done) {
|
||||
try {
|
||||
const user = await User.findOne({ email })
|
||||
if (!user) {
|
||||
return done(null, false)
|
||||
}
|
||||
|
||||
try {
|
||||
const isMatch = await user.validatePassword(password)
|
||||
|
||||
if (!isMatch) {
|
||||
return done(null, false)
|
||||
}
|
||||
|
||||
done(null, user)
|
||||
} catch (err) {
|
||||
done(err)
|
||||
}
|
||||
} catch (err) {
|
||||
return done(err)
|
||||
}
|
||||
}
|
||||
|
||||
// For testing
|
||||
module.exports = { passport, passportCallback }
|
||||
|
||||
Reference in New Issue
Block a user