commit 6e6b88e240dd37d18d339fcd8f0dc8a33315dc25
parent aea56eb3f71a73d1f36175c0dc1db71826a30e37
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Fri, 9 Feb 2024 18:43:17 -0800
better name
Diffstat:
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/pkg/database/tableUsers.go b/pkg/database/tableUsers.go
@@ -363,7 +363,7 @@ func (u *User) DoSave(db *DkfDB) {
}
}
-func (u *User) Disable2FA(db *DkfDB) {
+func (u *User) DisableTotp2FA(db *DkfDB) {
db.db.Model(u).Select("TwoFactorSecret", "TwoFactorRecovery").Updates(User{TwoFactorSecret: "", TwoFactorRecovery: ""})
}
diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go
@@ -459,7 +459,7 @@ func TwoFactorAuthenticationDisableHandler(c echo.Context) error {
data.ErrorPassword = "Invalid password"
return c.Render(http.StatusOK, "disable-totp", data)
}
- authUser.Disable2FA(db)
+ authUser.DisableTotp2FA(db)
db.CreateSecurityLog(authUser.ID, database.TotpDisabledSecurityLog)
return c.Render(http.StatusOK, "flash", FlashResponse{"Two-factor authentication disabled", "/settings/account", "alert-success"})
}