From 3a17f4f29f1be6f3e2b0bea0aa891e549dcb68a5 Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Mon, 5 Jun 2023 13:47:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=9D=A2=E6=9D=BF=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF=E4=BF=AE=E6=94=B9=20(#1249?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/setting.go | 4 ++++ frontend/src/lang/modules/en.ts | 12 +++++++++--- frontend/src/lang/modules/zh.ts | 8 ++++++-- frontend/src/views/setting/safe/allowips/index.vue | 4 +++- frontend/src/views/setting/safe/domain/index.vue | 6 +++++- 5 files changed, 27 insertions(+), 7 deletions(-) diff --git a/backend/app/service/setting.go b/backend/app/service/setting.go index c8a236c18..87a7931f3 100644 --- a/backend/app/service/setting.go +++ b/backend/app/service/setting.go @@ -121,6 +121,10 @@ func (u *SettingService) Update(key, value string) error { global.LOG.Errorf("restart system for new time zone failed, err: %v", err) } }() + case "BindDomain": + if len(value) != 0 { + _ = global.SESSION.Clean() + } case "UserName", "Password": _ = global.SESSION.Clean() } diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 6a787f635..aa55a8137 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -996,15 +996,21 @@ const message = { 'The password must contain at least eight characters and contain at least three uppercase letters, lowercase letters, digits, and special characters', bindDomain: 'Bind domain', + unBindDomain: 'Unbind domain', + unBindDomainHelper: + 'The action of unbinding a domain name may cause system insecurity. Do you want to continue?', bindDomainHelper: 'After the domain binding, only the domain in the setting can be used to access 1Panel service', bindDomainHelper1: 'If the binding domain is empty, the binding of the domain is cancelled', - bindDomainWarnning: - 'If the binding domain is empty, the binding of the domain is cancelled. Do you want to continue?', + bindDomainWarning: + 'After domain binding, you will be logged out and can only access 1Panel service through the domain name specified in the settings. Do you want to continue?', allowIPs: 'Authorized IP', + unAllowIPs: 'Unauthorized IP', + unAllowIPsWarning: + 'Authorizing an empty IP will allow all IPs to access the system, which may cause system insecurity. Do you want to continue?', allowIPsHelper: 'After setting the authorized IP address, only the IP address in the setting can access the 1Panel service', - allowIPsWarnning: + allowIPsWarning: 'After setting the authorized IP address, only the IP address in the setting can access the 1Panel service. Do you want to continue?', allowIPsHelper1: 'If the authorized IP address is empty, the authorized IP address is canceled', allowIPEgs: diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index 7908085f8..0be70de16 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -1015,12 +1015,16 @@ const message = { complexity: '密码复杂度验证', complexityHelper: '开启后密码必须满足密码长度大于 8 位且包含字母、数字及特殊字符', bindDomain: '域名绑定', + unBindDomain: '域名解绑', + unBindDomainHelper: '解除域名绑定可能造成系统不安全,是否继续?', bindDomainHelper: '设置域名绑定后,仅能通过设置中域名访问 1Panel 服务', bindDomainHelper1: '绑定域名为空时,则取消域名绑定', - bindDomainWarnning: '设置域名绑定后,仅能通过设置中域名访问 1Panel 服务,是否继续?', + bindDomainWarning: '设置域名绑定后,将退出当前登录,且仅能通过设置中域名访问 1Panel 服务,是否继续?', allowIPs: '授权 IP', + unAllowIPs: '取消授权', + unAllowIPsWarning: '授权 IP 为空将允许所有 IP 访问系统,可能造成系统不安全,是否继续?', allowIPsHelper: '设置授权 IP 后,仅有设置中的 IP 可以访问 1Panel 服务', - allowIPsWarnning: '设置授权 IP 后,仅有设置中的 IP 可以访问 1Panel 服务,是否继续?', + allowIPsWarning: '设置授权 IP 后,仅有设置中的 IP 可以访问 1Panel 服务,是否继续?', allowIPsHelper1: '授权 IP 为空时,则取消授权 IP', allowIPEgs: '当存在多个授权 IP 时,需要换行显示,例: \n172.16.10.111 \n172.16.10.112', mfa: '两步验证', diff --git a/frontend/src/views/setting/safe/allowips/index.vue b/frontend/src/views/setting/safe/allowips/index.vue index a01e419e4..3ebe5a647 100644 --- a/frontend/src/views/setting/safe/allowips/index.vue +++ b/frontend/src/views/setting/safe/allowips/index.vue @@ -65,7 +65,9 @@ const onSave = async () => { } } } - ElMessageBox.confirm(i18n.global.t('setting.allowIPsHelper'), i18n.global.t('setting.allowIPs'), { + let title = allowIPs.value ? i18n.global.t('setting.allowIPs') : i18n.global.t('setting.unAllowIPs'); + let allow = allowIPs.value ? i18n.global.t('setting.allowIPsWarning') : i18n.global.t('setting.unAllowIPsWarning'); + ElMessageBox.confirm(allow, title, { confirmButtonText: i18n.global.t('commons.button.confirm'), cancelButtonText: i18n.global.t('commons.button.cancel'), type: 'info', diff --git a/frontend/src/views/setting/safe/domain/index.vue b/frontend/src/views/setting/safe/domain/index.vue index b7228fccc..709e55dee 100644 --- a/frontend/src/views/setting/safe/domain/index.vue +++ b/frontend/src/views/setting/safe/domain/index.vue @@ -77,7 +77,11 @@ const onSavePort = async (formEl: FormInstance | undefined) => { if (!formEl) return; formEl.validate(async (valid) => { if (!valid) return; - ElMessageBox.confirm(i18n.global.t('setting.bindDomainWarnning'), i18n.global.t('setting.bindDomain'), { + let title = form.bindDomain ? i18n.global.t('setting.bindDomain') : i18n.global.t('setting.unBindDomain'); + let helper = form.bindDomain + ? i18n.global.t('setting.bindDomainWarning') + : i18n.global.t('setting.unBindDomainHelper'); + ElMessageBox.confirm(helper, title, { confirmButtonText: i18n.global.t('commons.button.confirm'), cancelButtonText: i18n.global.t('commons.button.cancel'), type: 'info',