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
path: root/web/html
diff options
context:
space:
mode:
Diffstat (limited to 'web/html')
-rw-r--r--web/html/modals/two_factor_modal.html18
-rw-r--r--web/html/settings.html37
2 files changed, 35 insertions, 20 deletions
diff --git a/web/html/modals/two_factor_modal.html b/web/html/modals/two_factor_modal.html
index 7823485f..13d22a5e 100644
--- a/web/html/modals/two_factor_modal.html
+++ b/web/html/modals/two_factor_modal.html
@@ -15,8 +15,8 @@
<p>{{ i18n "pages.settings.security.twoFactorModalSecondStep" }}</p>
<a-input v-model.trim="twoFactorModal.enteredCode" :style="{ width: '100%' }"></a-input>
</template>
- <template v-if="twoFactorModal.type === 'remove'">
- <p>{{ i18n "pages.settings.security.twoFactorModalRemoveStep" }}</p>
+ <template v-if="twoFactorModal.type === 'confirm'">
+ <p>[[ twoFactorModal.description ]]</p>
<a-input v-model.trim="twoFactorModal.enteredCode" :style="{ width: '100%' }"></a-input>
</template>
<template slot="footer">
@@ -32,6 +32,7 @@
<script>
const twoFactorModal = {
title: '',
+ description: '',
fileName: '',
token: '',
enteredCode: '',
@@ -45,17 +46,6 @@
ObjectUtil.execute(twoFactorModal.confirm, true)
twoFactorModal.close()
-
- switch (twoFactorModal.type) {
- case 'set':
- Vue.prototype.$message['success']('{{ i18n "pages.settings.security.twoFactorModalSetSuccess" }}')
- break;
- case 'remove':
- Vue.prototype.$message['success']('{{ i18n "pages.settings.security.twoFactorModalDeleteSuccess" }}')
- break;
- default:
- break;
- }
} else {
Vue.prototype.$message['error']('{{ i18n "pages.settings.security.twoFactorModalError" }}')
}
@@ -67,11 +57,13 @@
},
show: function ({
title = '',
+ description = '',
token = '',
type = 'set',
confirm = (success) => { }
}) {
this.title = title;
+ this.description = description;
this.token = token;
this.visible = true;
this.confirm = confirm;
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 = ""
}