mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
feat: add login by username or email
This commit is contained in:
1 parent
f5c465ab69
commit
5dd56308ce
2 files changed
+5
-2
No files matched your search
@@ -4,7 +4,9 @@ import User from '../models/user.js'
|
||||
|
||||
async function verifyPassword(username, password, done) {
|
||||
try {
|
||||
const user = await User.findOne({ username })
|
||||
const user = await User.findOne({
|
||||
$or: [{ username }, { email: username }],
|
||||
})
|
||||
if (!user) {
|
||||
return done(null, false, { message: 'Incorrect username.' })
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user