Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'web/service/user.go')
-rw-r--r--web/service/user.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/web/service/user.go b/web/service/user.go
index f0b04f52..ff5b8531 100644
--- a/web/service/user.go
+++ b/web/service/user.go
@@ -79,6 +79,16 @@ func (s *UserService) UpdateUser(id int, username string, password string) error
return err
}
+ twoFactorEnable, err := s.settingService.GetTwoFactorEnable()
+ if err != nil {
+ return err
+ }
+
+ if twoFactorEnable {
+ s.settingService.SetTwoFactorEnable(false)
+ s.settingService.SetTwoFactorToken("")
+ }
+
return db.Model(model.User{}).
Where("id = ?", id).
Updates(map[string]any{"username": username, "password": hashedPassword}).