mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-27 08:19:00 +01:00
Fix:Server crash when user without a password attempts to login with a password #2378
This commit is contained in:
parent
fbc2c2b481
commit
84160b2f07
@ -542,13 +542,13 @@ class Auth {
|
|||||||
// Load the user given it's username
|
// Load the user given it's username
|
||||||
const user = await Database.userModel.getUserByUsername(username.toLowerCase())
|
const user = await Database.userModel.getUserByUsername(username.toLowerCase())
|
||||||
|
|
||||||
if (!user || !user.isActive) {
|
if (!user?.isActive) {
|
||||||
done(null, null)
|
done(null, null)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check passwordless root user
|
// Check passwordless root user
|
||||||
if (user.type === 'root' && (!user.pash || user.pash === '')) {
|
if (user.type === 'root' && !user.pash) {
|
||||||
if (password) {
|
if (password) {
|
||||||
// deny login
|
// deny login
|
||||||
done(null, null)
|
done(null, null)
|
||||||
@ -557,6 +557,10 @@ class Auth {
|
|||||||
// approve login
|
// approve login
|
||||||
done(null, user)
|
done(null, user)
|
||||||
return
|
return
|
||||||
|
} else if (!user.pash) {
|
||||||
|
Logger.error(`[Auth] User "${user.username}"/"${user.type}" attempted to login without a password set`)
|
||||||
|
done(null, null)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check password match
|
// Check password match
|
||||||
|
Loading…
Reference in New Issue
Block a user