mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-27 00:08:51 +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
|
||||
const user = await Database.userModel.getUserByUsername(username.toLowerCase())
|
||||
|
||||
if (!user || !user.isActive) {
|
||||
if (!user?.isActive) {
|
||||
done(null, null)
|
||||
return
|
||||
}
|
||||
|
||||
// Check passwordless root user
|
||||
if (user.type === 'root' && (!user.pash || user.pash === '')) {
|
||||
if (user.type === 'root' && !user.pash) {
|
||||
if (password) {
|
||||
// deny login
|
||||
done(null, null)
|
||||
@ -557,6 +557,10 @@ class Auth {
|
||||
// approve login
|
||||
done(null, user)
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user