Fix users with disabled totp but not enrolled being unable to login

This commit is contained in:
kolaente 2020-08-07 16:41:35 +02:00
parent 6a82d4e2af
commit d718d247c8
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -50,7 +50,9 @@ func TOTPEnabledForUser(user *User) (bool, error) {
if !config.ServiceEnableTotp.GetBool() {
return false, nil
}
return x.Where("user_id = ?", user.ID).Exist(&TOTP{})
t := &TOTP{}
_, err := x.Where("user_id = ?", user.ID).Get(t)
return t.Enabled, err
}
// GetTOTPForUser returns the current state of totp settings for the user.