Fixed nil password causing invalid dereferences
This commit is contained in:
No files matched your search
+1
-1
@@ -169,7 +169,7 @@ type User struct {
|
|||||||
ID int `gorm:"primary_key"`
|
ID int `gorm:"primary_key"`
|
||||||
CreatedAt time.Time
|
CreatedAt time.Time
|
||||||
Name string `gorm:"not null; unique_index" sql:"default: null"`
|
Name string `gorm:"not null; unique_index" sql:"default: null"`
|
||||||
Password string `gorm:"not null" sql:"default: null"`
|
Password string `sql:"default: null"`
|
||||||
LastFMSession string `sql:"default: null"`
|
LastFMSession string `sql:"default: null"`
|
||||||
ListenBrainzURL string `sql:"default: null"`
|
ListenBrainzURL string `sql:"default: null"`
|
||||||
ListenBrainzToken string `sql:"default: null"`
|
ListenBrainzToken string `sql:"default: null"`
|
||||||
|
|||||||
@@ -146,9 +146,9 @@ func (c *Controller) WithUser(next http.Handler) http.Handler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var credsOk bool
|
var credsOk bool
|
||||||
if tokenAuth && !newLDAPUser {
|
if tokenAuth && !newLDAPUser && user != nil {
|
||||||
credsOk = checkCredsToken(user.Password, token, salt)
|
credsOk = checkCredsToken(user.Password, token, salt)
|
||||||
} else if !newLDAPUser {
|
} else if !newLDAPUser && user != nil {
|
||||||
credsOk = checkCredsBasic(user.Password, password)
|
credsOk = checkCredsBasic(user.Password, password)
|
||||||
}
|
}
|
||||||
if !credsOk {
|
if !credsOk {
|
||||||
|
|||||||
Reference in New Issue
Block a user