From cecfecfe9408e3b708a633e8fd2ba37991c4f855 Mon Sep 17 00:00:00 2001 From: ssongliu Date: Mon, 26 Dec 2022 16:15:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20mysql=20=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E5=91=BD=E5=90=8D=E8=A7=84=E5=88=99=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/app_install.go | 9 ++++++++- frontend/src/global/form-rules.ts | 2 +- frontend/src/lang/modules/en.ts | 2 +- frontend/src/lang/modules/zh.ts | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/backend/app/service/app_install.go b/backend/app/service/app_install.go index 5e86963d6..af1c11b52 100644 --- a/backend/app/service/app_install.go +++ b/backend/app/service/app_install.go @@ -495,7 +495,14 @@ func updateInstallInfoInDB(appKey, appName, param string, isRestart bool, value "param": strings.ReplaceAll(appInstall.Param, oldVal, newVal), "env": strings.ReplaceAll(appInstall.Env, oldVal, newVal), }, commonRepo.WithByID(appInstall.ID)) - + } + if param == "user-password" { + oldVal = fmt.Sprintf("\"PANEL_DB_USER_PASSWORD\":\"%v\"", appInstall.Password) + newVal = fmt.Sprintf("\"PANEL_DB_USER_PASSWORD\":\"%v\"", value) + _ = appInstallRepo.BatchUpdateBy(map[string]interface{}{ + "param": strings.ReplaceAll(appInstall.Param, oldVal, newVal), + "env": strings.ReplaceAll(appInstall.Env, oldVal, newVal), + }, commonRepo.WithByID(appInstall.ID)) } if param == "port" { oldVal = fmt.Sprintf("\"PANEL_APP_PORT_HTTP\":%v", appInstall.Port) diff --git a/frontend/src/global/form-rules.ts b/frontend/src/global/form-rules.ts index f3130ba5b..f881a8d74 100644 --- a/frontend/src/global/form-rules.ts +++ b/frontend/src/global/form-rules.ts @@ -58,7 +58,7 @@ const checkDBName = (rule: any, value: any, callback: any) => { if (value === '' || typeof value === 'undefined' || value == null) { callback(new Error(i18n.global.t('commons.rule.dbName'))); } else { - const reg = /^[a-zA-Z0-9]{1}[a-zA-Z0-9_.-]{0,30}$/; + const reg = /^[a-zA-Z0-9\u4e00-\u9fa5]{1}[a-zA-Z0-9_.\u4e00-\u9fa5-]{0,16}$/; if (!reg.test(value) && value !== '') { callback(new Error(i18n.global.t('commons.rule.dbName'))); } else { diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index be0c91745..939810bd0 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -104,7 +104,7 @@ export default { requiredSelect: 'Please select the required fields', commonName: 'Support English, Chinese, numbers, .-, and _ length 1-30', simpleName: 'Support English, numbers and _ length 1-30', - dbName: 'Support English, numbers, .-, and _ length 1-30', + dbName: 'Support English, Chinese, numbers, .-, and _ length 1-16', imageName: 'Support English, Chinese, numbers, :.-_, length 1-30', complexityPassword: 'Please enter a password with more than 8 characters and must contain letters, digits, and special symbols', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index 0c9cdb16d..22045f558 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -104,7 +104,7 @@ export default { requiredSelect: '请选择必选项', commonName: '支持英文、中文、数字、.-和_,长度1-30', simpleName: '支持英文、数字、_,长度1-30', - dbName: '支持英文、数字、:.-_,长度1-30', + dbName: '支持英文、中文、数字、.-_,长度1-16', imageName: '支持英文、中文、数字、:.-_,长度1-30', complexityPassword: '请输入 8 位以上、必须含有字母、数字、特殊符号的密码', commonPassword: '请输入 6 位以上长度密码',