aboutsummaryrefslogtreecommitdiff
path: root/internal/route/user/setting.go
diff options
context:
space:
mode:
authorJoe Chen <jc@unknwon.io>2022-10-23 21:22:36 +0800
committerGitHub <noreply@github.com>2022-10-23 21:22:36 +0800
commit3265abfbc22ef36871d8e69f0f9a3a4a5b40b768 (patch)
tree0079202cdf2e84f7366ba1b1b8064233721f093c /internal/route/user/setting.go
parentd0a4a3401c1c62def511df42769b13cdfba10a6a (diff)
refactor(db): migrate perms methods off `user.go` (#7207)
Diffstat (limited to 'internal/route/user/setting.go')
-rw-r--r--internal/route/user/setting.go8
1 files changed, 4 insertions, 4 deletions
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
}