diff --git a/build/database/lite/install/sys_config.sql b/build/database/lite/install/sys_config.sql index 25a0aee7..8daff267 100644 --- a/build/database/lite/install/sys_config.sql +++ b/build/database/lite/install/sys_config.sql @@ -28,7 +28,7 @@ INSERT INTO "sys_config" VALUES (5, 'config.sys.user.lockTime', 'sys.user.lockTi INSERT INTO "sys_config" VALUES (6, 'config.sys.officialUrl', 'sys.officialUrl', '#', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.officialUrlRemark'); INSERT INTO "sys_config" VALUES (7, 'config.sys.helpDoc', 'sys.helpDoc', '/static/helpDoc/{language}_doc.pdf', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.helpDocRemark'); INSERT INTO "sys_config" VALUES (8, 'sys.account.captchaType', 'sys.account.captchaType', 'math', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'sys.account.captchaTypeRemark'); -INSERT INTO "sys_config" VALUES (9, 'config.sys.user.passwordPolicy', 'sys.user.passwordPolicy', '{"minLength":8,"specialChars":2,"uppercase":1,"lowercase":1}', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.user.passwordPolicyRemark'); +INSERT INTO "sys_config" VALUES (9, 'config.sys.user.passwordPolicy', 'sys.user.passwordPolicy', '{"minLength":6,"specialChars":0,"uppercase":0,"lowercase":0}', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.user.passwordPolicyRemark'); INSERT INTO "sys_config" VALUES (10, 'config.sys.user.passwdExpire', 'sys.user.passwdExpire', '{"expHours":0,"alertHours":360}', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.user.passwdExpireRemark'); INSERT INTO "sys_config" VALUES (11, 'config.sys.user.fristPasswdChange', 'sys.user.fristPasswdChange', 'false', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.user.fristPasswdChangeRemark'); INSERT INTO "sys_config" VALUES (12, 'config.sys.user.passwdNotAllowedHistory', 'sys.user.passwdNotAllowedHistory', '0', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.user.passwdNotAllowedHistoryRemark'); diff --git a/build/database/lite/upgrade/upg_sys_config.sql b/build/database/lite/upgrade/upg_sys_config.sql new file mode 100644 index 00000000..5c378642 --- /dev/null +++ b/build/database/lite/upgrade/upg_sys_config.sql @@ -0,0 +1,45 @@ +-- ---------------------------- +-- Table structure for sys_config +-- ---------------------------- +CREATE TABLE IF NOT EXISTS "sys_config" ( + "config_id" integer NOT NULL, + "config_name" text(64), + "config_key" text(64), + "config_value" text(500), + "config_type" text(1), + "del_flag" text(1), + "create_by" text(64), + "create_time" integer, + "update_by" text(64), + "update_time" integer, + "remark" text(500), + PRIMARY KEY ("config_id") +); + +-- ---------------------------- +-- Records of sys_config +-- ---------------------------- +REPLACE INTO "sys_config" VALUES (1, 'config.sys.user.initPassword', 'sys.user.initPassword', 'Abcd@1234..', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.user.initPasswordRemark'); +REPLACE INTO "sys_config" VALUES (2, 'config.sys.account.captchaEnabled', 'sys.account.captchaEnabled', 'false', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.account.captchaEnabledRemark'); +REPLACE INTO "sys_config" VALUES (3, 'config.sys.account.registerUser', 'sys.account.registerUser', 'false', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.account.registerUserRemark'); +REPLACE INTO "sys_config" VALUES (4, 'config.sys.user.maxRetryCount', 'sys.user.maxRetryCount', '5', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.user.maxRetryCountRemark'); +REPLACE INTO "sys_config" VALUES (5, 'config.sys.user.lockTime', 'sys.user.lockTime', '10', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.user.lockTimeRemark'); +REPLACE INTO "sys_config" VALUES (6, 'config.sys.officialUrl', 'sys.officialUrl', '#', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.officialUrlRemark'); +REPLACE INTO "sys_config" VALUES (7, 'config.sys.helpDoc', 'sys.helpDoc', '/static/helpDoc/{language}_doc.pdf', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.helpDocRemark'); +REPLACE INTO "sys_config" VALUES (8, 'sys.account.captchaType', 'sys.account.captchaType', 'math', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'sys.account.captchaTypeRemark'); +REPLACE INTO "sys_config" VALUES (9, 'config.sys.user.passwordPolicy', 'sys.user.passwordPolicy', '{"minLength":6,"specialChars":0,"uppercase":0,"lowercase":0}', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.user.passwordPolicyRemark'); +REPLACE INTO "sys_config" VALUES (10, 'config.sys.user.passwdExpire', 'sys.user.passwdExpire', '{"expHours":0,"alertHours":360}', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.user.passwdExpireRemark'); +REPLACE INTO "sys_config" VALUES (11, 'config.sys.user.fristPasswdChange', 'sys.user.fristPasswdChange', 'false', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.user.fristPasswdChangeRemark'); +REPLACE INTO "sys_config" VALUES (12, 'config.sys.user.passwdNotAllowedHistory', 'sys.user.passwdNotAllowedHistory', '0', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.user.passwdNotAllowedHistoryRemark'); +REPLACE INTO "sys_config" VALUES (21, 'config.monitor.sysResource.storeDays', 'monitor.sysResource.storeDays', '30', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.monitor.sysResource.storeDaysRemark'); +REPLACE INTO "sys_config" VALUES (22, 'config.sys.logo.type', 'sys.logo.type', 'brand', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.logo.typeRemark'); +REPLACE INTO "sys_config" VALUES (23, 'config.sys.logo.filePathIcon', 'sys.logo.filePathIcon', '/static/logo/{language}_icon.png', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.logo.filePathIconRemark'); +REPLACE INTO "sys_config" VALUES (24, 'config.sys.logo.filePathBrand', 'sys.logo.filePathBrand', '/static/logo/{language}_brand.png', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.logo.filePathBrandRemark'); +REPLACE INTO "sys_config" VALUES (25, 'config.sys.loginBackground', 'sys.loginBackground', '#', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.loginBackgroundRemark'); +REPLACE INTO "sys_config" VALUES (26, 'config.sys.title', 'sys.title', 'config.sys.titleValue', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.titleRemark'); +REPLACE INTO "sys_config" VALUES (27, 'config.sys.copyright', 'sys.copyright', 'config.sys.copyrightValue', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.copyrightRemark'); +REPLACE INTO "sys_config" VALUES (28, 'config.sys.i18nOpen', 'sys.i18n.open', 'true', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.i18nOpenRemark'); +REPLACE INTO "sys_config" VALUES (29, 'config.sys.i18nDefault', 'sys.i18n.default', 'en_US', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.i18nDefaultRemark'); +REPLACE INTO "sys_config" VALUES (30, 'config.sys.lockTime', 'sys.lockTime', '0', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.lockTimeRemark'); +REPLACE INTO "sys_config" VALUES (31, 'config.sys.homePage', 'sys.homePage', 'configManage/neOverview/index', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.homePageRemark'); +REPLACE INTO "sys_config" VALUES (32, 'config.neData.backupDataFTP', 'neData.backupDataFTP', 'VXEECeDMoYhX29pqsb753ecJOnPfxB6XrEa9QdUrRqwKI7EmJei5HlvehvL+wL0Osjo3Y2Qs7ADA6eL3SrisiVXAVVXv38KMhvcSU9eaAzl/jrY4ahsq6a/eSbzxFDgE21US7/YnsyDRG7eGAc7W5Q==', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.neData.backupDataFTPRemark'); diff --git a/build/database/std/install/sys_config.sql b/build/database/std/install/sys_config.sql index 2300c5ef..43ea90f5 100644 --- a/build/database/std/install/sys_config.sql +++ b/build/database/std/install/sys_config.sql @@ -32,7 +32,7 @@ INSERT INTO `sys_config` VALUES (5, 'config.sys.user.lockTime', 'sys.user.lockTi INSERT INTO `sys_config` VALUES (6, 'config.sys.officialUrl', 'sys.officialUrl', '#', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.officialUrlRemark'); INSERT INTO `sys_config` VALUES (7, 'config.sys.helpDoc', 'sys.helpDoc', '/static/helpDoc/{language}_doc.pdf', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.helpDocRemark'); INSERT INTO `sys_config` VALUES (8, 'sys.account.captchaType', 'sys.account.captchaType', 'math', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'sys.account.captchaTypeRemark'); -INSERT INTO `sys_config` VALUES (9, 'config.sys.user.passwordPolicy', 'sys.user.passwordPolicy', '{\"minLength\":8,\"specialChars\":2,\"uppercase\":1,\"lowercase\":1}', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.user.passwordPolicyRemark'); +INSERT INTO `sys_config` VALUES (9, 'config.sys.user.passwordPolicy', 'sys.user.passwordPolicy', '{\"minLength\":6,\"specialChars\":0,\"uppercase\":0,\"lowercase\":0}', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.user.passwordPolicyRemark'); INSERT INTO `sys_config` VALUES (10, 'config.sys.user.passwdExpire', 'sys.user.passwdExpire', '{\"expHours\":0,\"alertHours\":360}', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.user.passwdExpireRemark'); INSERT INTO `sys_config` VALUES (11, 'config.sys.user.fristPasswdChange', 'sys.user.fristPasswdChange', 'false', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.user.fristPasswdChangeRemark'); INSERT INTO `sys_config` VALUES (12, 'config.sys.user.passwdNotAllowedHistory', 'sys.user.passwdNotAllowedHistory', '0', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.user.passwdNotAllowedHistoryRemark'); diff --git a/build/database/std/upgrade/upg_sys_config.sql b/build/database/std/upgrade/upg_sys_config.sql index b7859ba5..d9236c58 100644 --- a/build/database/std/upgrade/upg_sys_config.sql +++ b/build/database/std/upgrade/upg_sys_config.sql @@ -41,7 +41,7 @@ REPLACE INTO `sys_config` VALUES (5, 'config.sys.user.lockTime', 'sys.user.lockT REPLACE INTO `sys_config` VALUES (6, 'config.sys.officialUrl', 'sys.officialUrl', '#', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.officialUrlRemark'); REPLACE INTO `sys_config` VALUES (7, 'config.sys.helpDoc', 'sys.helpDoc', '/static/helpDoc/{language}_doc.pdf', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.helpDocRemark'); REPLACE INTO `sys_config` VALUES (8, 'sys.account.captchaType', 'sys.account.captchaType', 'math', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'sys.account.captchaTypeRemark'); -REPLACE INTO `sys_config` VALUES (9, 'config.sys.user.passwordPolicy', 'sys.user.passwordPolicy', '{\"minLength\":8,\"specialChars\":2,\"uppercase\":1,\"lowercase\":1}', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.user.passwordPolicyRemark'); +REPLACE INTO `sys_config` VALUES (9, 'config.sys.user.passwordPolicy', 'sys.user.passwordPolicy', '{\"minLength\":6,\"specialChars\":0,\"uppercase\":0,\"lowercase\":0}', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.user.passwordPolicyRemark'); REPLACE INTO `sys_config` VALUES (10, 'config.sys.user.passwdExpire', 'sys.user.passwdExpire', '{\"expHours\":0,\"alertHours\":360}', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.user.passwdExpireRemark'); REPLACE INTO `sys_config` VALUES (11, 'config.sys.user.fristPasswdChange', 'sys.user.fristPasswdChange', 'false', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.user.fristPasswdChangeRemark'); REPLACE INTO `sys_config` VALUES (12, 'config.sys.user.passwdNotAllowedHistory', 'sys.user.passwdNotAllowedHistory', '0', 'Y', '0', 'system', 1704960008300, 'system', 1704960008300, 'config.sys.user.passwdNotAllowedHistoryRemark'); diff --git a/src/framework/utils/regular/regular.go b/src/framework/utils/regular/regular.go index 3eeb31c6..c3804698 100644 --- a/src/framework/utils/regular/regular.go +++ b/src/framework/utils/regular/regular.go @@ -19,7 +19,7 @@ func ValidUsername(username string) bool { if username == "" { return false } - pattern := `^[a-zA-Z][a-z0-9A-Z]{5,}` + pattern := `^.{4,}$` //`^[a-zA-Z][a-z0-9A-Z]{5,}` match, err := regexp.MatchString(pattern, username) if err != nil { return false diff --git a/src/modules/system/controller/sys_user.go b/src/modules/system/controller/sys_user.go index 60758dc3..3ea14fef 100644 --- a/src/modules/system/controller/sys_user.go +++ b/src/modules/system/controller/sys_user.go @@ -186,7 +186,7 @@ func (s *SysUserController) Add(c *gin.Context) { } if !regular.ValidUsername(body.UserName) { // msg := fmt.Sprintf("新增用户【%s】失败,登录账号用户账号只能包含大写小写字母,数字,且不少于4位", body.UserName) - msg := fmt.Sprintf("Add a new user [%s] failed to log in the account user account can only contain upper and lower case letters, numbers, and not less than 4 digits", body.UserName) + msg := fmt.Sprintf("Add a new user [%s] failed to log in the account user account not less than 4 digits", body.UserName) c.JSON(400, resp.ErrMsg(msg)) return }