From 3265abfbc22ef36871d8e69f0f9a3a4a5b40b768 Mon Sep 17 00:00:00 2001 From: Joe Chen Date: Sun, 23 Oct 2022 21:22:36 +0800 Subject: refactor(db): migrate perms methods off `user.go` (#7207) --- internal/route/user/setting.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'internal/route/user/setting.go') diff --git a/internal/route/user/setting.go b/internal/route/user/setting.go index 3ea1c33e..f29ffb36 100644 --- a/internal/route/user/setting.go +++ b/internal/route/user/setting.go @@ -386,7 +386,7 @@ func SettingsSecurity(c *context.Context) { } func SettingsTwoFactorEnable(c *context.Context) { - if c.User.IsEnabledTwoFactor() { + if db.TwoFactors.IsEnabled(c.Req.Context(), c.User.ID) { c.NotFound() return } @@ -456,7 +456,7 @@ func SettingsTwoFactorEnablePost(c *context.Context) { } func SettingsTwoFactorRecoveryCodes(c *context.Context) { - if !c.User.IsEnabledTwoFactor() { + if !db.TwoFactors.IsEnabled(c.Req.Context(), c.User.ID) { c.NotFound() return } @@ -475,7 +475,7 @@ func SettingsTwoFactorRecoveryCodes(c *context.Context) { } func SettingsTwoFactorRecoveryCodesPost(c *context.Context) { - if !c.User.IsEnabledTwoFactor() { + if !db.TwoFactors.IsEnabled(c.Req.Context(), c.User.ID) { c.NotFound() return } @@ -490,7 +490,7 @@ func SettingsTwoFactorRecoveryCodesPost(c *context.Context) { } func SettingsTwoFactorDisable(c *context.Context) { - if !c.User.IsEnabledTwoFactor() { + if !db.TwoFactors.IsEnabled(c.Req.Context(), c.User.ID) { c.NotFound() return } -- cgit v1.2.3