From fe3b1c9b52f584b0f045907585b206344fed55db Mon Sep 17 00:00:00 2001 From: "Shishkevich D." <135337715+shishkevichd@users.noreply.github.com> Date: Thu, 8 May 2025 21:20:58 +0700 Subject: chore: implement 2fa auth (#2968) * chore: implement 2fa auth from #2786 * chore: format code * chore: replace two factor token input with qr-code * chore: requesting confirmation of setting/removing two-factor authentication otpauth library was taken from cdnjs * chore: revert changes in `ClipboardManager` don't need it. * chore: removing twoFactor prop in settings page * chore: remove `twoFactorQr` object in `mounted` function --- main.go | 35 ----------------------------------- 1 file changed, 35 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index ed30a11f..a94a899b 100644 --- a/main.go +++ b/main.go @@ -346,36 +346,6 @@ func migrateDb() { fmt.Println("Migration done!") } -func removeSecret() { - userService := service.UserService{} - - secretExists, err := userService.CheckSecretExistence() - if err != nil { - fmt.Println("Error checking secret existence:", err) - return - } - - if !secretExists { - fmt.Println("No secret exists to remove.") - return - } - - err = userService.RemoveUserSecret() - if err != nil { - fmt.Println("Error removing secret:", err) - return - } - - settingService := service.SettingService{} - err = settingService.SetSecretStatus(false) - if err != nil { - fmt.Println("Error updating secret status:", err) - return - } - - fmt.Println("Secret removed successfully.") -} - func main() { if len(os.Args) < 2 { runWebServer() @@ -403,10 +373,8 @@ func main() { var reset bool var show bool var getCert bool - var remove_secret bool settingCmd.BoolVar(&reset, "reset", false, "Reset all settings") settingCmd.BoolVar(&show, "show", false, "Display current settings") - settingCmd.BoolVar(&remove_secret, "remove_secret", false, "Remove secret key") settingCmd.IntVar(&port, "port", 0, "Set panel port number") settingCmd.StringVar(&username, "username", "", "Set login username") settingCmd.StringVar(&password, "password", "", "Set login password") @@ -470,9 +438,6 @@ func main() { if (tgbottoken != "") || (tgbotchatid != "") || (tgbotRuntime != "") { updateTgbotSetting(tgbottoken, tgbotchatid, tgbotRuntime) } - if remove_secret { - removeSecret() - } if enabletgbot { updateTgbotEnableSts(enabletgbot) } -- cgit v1.2.3