Fix users with disabled totp but not enrolled being unable to login
continuous-integration/drone/push Build is passing Details

This commit is contained in:
kolaente 2020-08-07 16:41:35 +02:00
parent 6a82d4e2af
commit d718d247c8
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 3 additions and 1 deletions

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.