From d718d247c8f5c52fe0b926282cefb7478fa95dbe Mon Sep 17 00:00:00 2001 From: kolaente Date: Fri, 7 Aug 2020 16:41:35 +0200 Subject: [PATCH] Fix users with disabled totp but not enrolled being unable to login --- pkg/user/totp.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/user/totp.go b/pkg/user/totp.go index 478b80ce..d6ea149d 100644 --- a/pkg/user/totp.go +++ b/pkg/user/totp.go @@ -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.