diff options
| author | Shishkevich D. <135337715+shishkevichd@users.noreply.github.com> | 2025-07-02 12:25:25 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-02 12:25:25 +0300 |
| commit | 5d11e6e13f7254a72874dabee6c1cf4e81f5ec52 (patch) | |
| tree | 3e255de35ef4f9f4cb79daabaa7a696f10263dc1 /web/html/settings.html | |
| parent | f3d0b92e4ab2737f96fea3d0f567fdc040c21acb (diff) | |
chore: reset two-factor authentication after changing admin credentials (#3029)
* chore: add `resetTwoFactor` argument for main.go
fixes #3025
* chore: reset two-factor authentication after changing admin credentials
* chore: reset two-factor authentication after changing admin credentials
---------
Co-authored-by: somebodywashere <68244480+somebodywashere@users.noreply.github.com>
Co-authored-by: Sanaei <ho3ein.sanaei@gmail.com>
Diffstat (limited to 'web/html/settings.html')
| -rw-r--r-- | web/html/settings.html | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/web/html/settings.html b/web/html/settings.html index 1c55ea81..c7fa9bd8 100644 --- a/web/html/settings.html +++ b/web/html/settings.html @@ -310,12 +310,30 @@ } }, async updateUser() { - this.loading(true); - const msg = await HttpUtil.post("/panel/setting/updateUser", this.user); - this.loading(false); - if (msg.success) { - this.user = {}; - window.location.replace(basePath + "logout"); + const sendUpdateUserRequest = async () => { + this.loading(true); + const msg = await HttpUtil.post("/panel/setting/updateUser", this.user); + this.loading(false); + if (msg.success) { + this.user = {}; + window.location.replace(basePath + "logout"); + } + } + + if (this.allSetting.twoFactorEnable) { + twoFactorModal.show({ + title: '{{ i18n "pages.settings.security.twoFactorModalChangeCredentialsTitle" }}', + description: '{{ i18n "pages.settings.security.twoFactorModalChangeCredentialsStep" }}', + token: this.allSetting.twoFactorToken, + type: 'confirm', + confirm: (success) => { + if (success) { + sendUpdateUserRequest(); + } + } + }) + } else { + sendUpdateUserRequest(); } }, async restartPanel() { @@ -353,6 +371,8 @@ type: 'set', confirm: (success) => { if (success) { + Vue.prototype.$message['success']('{{ i18n "pages.settings.security.twoFactorModalSetSuccess" }}') + this.allSetting.twoFactorToken = newTwoFactorToken } @@ -362,10 +382,13 @@ } else { twoFactorModal.show({ title: '{{ i18n "pages.settings.security.twoFactorModalDeleteTitle" }}', + description: '{{ i18n "pages.settings.security.twoFactorModalRemoveStep" }}', token: this.allSetting.twoFactorToken, - type: 'remove', + type: 'confirm', confirm: (success) => { if (success) { + Vue.prototype.$message['success']('{{ i18n "pages.settings.security.twoFactorModalDeleteSuccess" }}') + this.allSetting.twoFactorEnable = false this.allSetting.twoFactorToken = "" } |
