change password rule (#4804)

* change password rule

* change password.tset.ts
This commit is contained in:
dreamer6680
2025-05-13 18:20:11 +08:00
committed by GitHub
parent 3688842cc7
commit 12acaf491c
11 changed files with 25 additions and 25 deletions

View File

@@ -5,7 +5,7 @@ export const checkPasswordRule = (password: string) => {
/[A-Z]/, // Contains uppercase letters
/[!@#$%^&*()_+=-]/ // Contains special characters
];
const validChars = /^[\dA-Za-z!@#$%^&*()_+=-]{6,100}$/;
const validChars = /^[\dA-Za-z!@#$%^&*()_+=-]{8,100}$/;
// Check length and valid characters
if (!validChars.test(password)) return false;

View File

@@ -47,7 +47,7 @@
"package_usage_rules": "Package usage rules: The system will give priority to using more advanced packages, and the original unused packages will take effect later.",
"password": "Password",
"password_mismatch": "Password Inconsistency: Two passwords are inconsistent",
"password_tip": "Password must be at least 6 characters long and contain at least two combinations: numbers, letters, or special characters",
"password_tip": "Password must be at least 8 characters long and contain at least two combinations: numbers, letters, or special characters",
"password_update_error": "Exception when changing password",
"password_update_success": "Password changed successfully",
"pending_usage": "To be used",

View File

@@ -1,7 +1,6 @@
{
"Action": "Action",
"Add": "Add",
"add_success": "Added Successfully",
"Add_new_input": "Add new input",
"All": "All",
"App": "Application",
@@ -64,7 +63,6 @@
"Parse": "Analysis",
"Permission": "Permission",
"Permission_tip": "Individual permissions are greater than group permissions",
"please_input_name": "Please Enter a Name",
"Preview": "Preview",
"Remove": "Remove",
"Rename": "Rename",
@@ -94,6 +92,7 @@
"action_confirm": "Confirm",
"add_new": "add_new",
"add_new_param": "Add new param",
"add_success": "Added Successfully",
"all_quotes": "All quotes",
"all_result": "Full Results",
"app_not_version": "This application has not been published, please publish it first",
@@ -962,6 +961,7 @@
"permission.manager": "administrator",
"permission.read": "Read permission",
"permission.write": "write permission",
"please_input_name": "Please Enter a Name",
"plugin.App": "Select App",
"plugin.Currentapp": "Current App",
"plugin.Description": "Description",
@@ -1260,7 +1260,7 @@
"user.no_usage_records": "No Usage Records",
"user.old_password": "Old Password",
"user.password_message": "Password must be at least 4 characters and at most 60 characters",
"user.password_tip": "Password must be at least 6 characters long and contain at least two combinations: numbers, letters, or special characters",
"user.password_tip": "Password must be at least 8 characters long and contain at least two combinations: numbers, letters, or special characters",
"user.reset_password": "Reset Password",
"user.reset_password_tip": "The initial password is not set/the password has not been modified for a long time, please reset the password",
"user.team.Balance": "Team Balance",

View File

@@ -8,7 +8,7 @@
"login_success": "Login successful",
"no_remind": "Don't remind again",
"password_condition": "Password maximum 60 characters",
"password_tip": "Password must be at least 6 characters long and contain at least two combinations: numbers, letters, or special characters",
"password_tip": "Password must be at least 8 characters long and contain at least two combinations: numbers, letters, or special characters",
"policy_tip": "By using this service, you agree to our",
"privacy": "Privacy Policy",
"privacy_policy": "Privacy Policy",

View File

@@ -45,7 +45,7 @@
"package_usage_rules": "套餐使用规则:系统优先使用更高级的套餐,原未用完的套餐将延后生效",
"password": "密码",
"password_mismatch": "密码不一致: 两次密码不一致",
"password_tip": "密码至少 6 位,且至少包含两种组合:数字、字母或特殊字符",
"password_tip": "密码至少 8 位,且至少包含两种组合:数字、字母或特殊字符",
"password_update_error": "修改密码异常",
"password_update_success": "修改密码成功",
"pending_usage": "待使用",

View File

@@ -1,7 +1,6 @@
{
"Action": "操作",
"Add": "添加",
"add_success": "添加成功",
"Add_new_input": "新增输入",
"All": "全部",
"App": "应用",
@@ -64,7 +63,6 @@
"Parse": "解析",
"Permission": "权限",
"Permission_tip": "个人权限大于群组权限",
"please_input_name": "请输入名称",
"Preview": "预览",
"Remove": "移除",
"Rename": "重命名",
@@ -94,6 +92,7 @@
"action_confirm": "操作确认",
"add_new": "新增",
"add_new_param": "新增参数",
"add_success": "添加成功",
"all_quotes": "全部引用",
"all_result": "完整结果",
"app_not_version": " 该应用未发布过,请先发布应用",
@@ -961,6 +960,7 @@
"permission.manager": "管理员",
"permission.read": "读权限",
"permission.write": "写权限",
"please_input_name": "请输入名称",
"plugin.App": "选择应用",
"plugin.Currentapp": "当前应用",
"plugin.Description": "描述",
@@ -1259,7 +1259,7 @@
"user.no_usage_records": "暂无使用记录",
"user.old_password": "旧密码",
"user.password_message": "密码最少 4 位最多 60 位",
"user.password_tip": "密码至少 6 位,且至少包含两种组合:数字、字母或特殊字符",
"user.password_tip": "密码至少 8 位,且至少包含两种组合:数字、字母或特殊字符",
"user.reset_password": "重置密码",
"user.reset_password_tip": "未设置初始密码/长时间未修改密码,请重置密码",
"user.team.Balance": "团队余额",

View File

@@ -8,7 +8,7 @@
"login_success": "登录成功",
"no_remind": "不再提醒",
"password_condition": "密码最多 60 位",
"password_tip": "密码至少 6 位,且至少包含两种组合:数字、字母或特殊字符",
"password_tip": "密码至少 8 位,且至少包含两种组合:数字、字母或特殊字符",
"policy_tip": "使用即代表你同意我们的",
"privacy": "隐私协议",
"privacy_policy": "隐私政策",

View File

@@ -47,7 +47,7 @@
"package_usage_rules": "套餐使用規則:系統優先使用更進階的套餐,原未用完的套餐將延遲生效",
"password": "密碼",
"password_mismatch": "密碼不一致:兩次密碼不一致",
"password_tip": "密碼至少 6 位,且至少包含兩種組合:數字、字母或特殊字元",
"password_tip": "密碼至少 8 位,且至少包含兩種組合:數字、字母或特殊字元",
"password_update_error": "修改密碼異常",
"password_update_success": "修改密碼成功",
"pending_usage": "待使用",

View File

@@ -1,7 +1,6 @@
{
"Action": "操作",
"Add": "新增",
"add_success": "新增成功",
"Add_new_input": "新增輸入",
"All": "全部",
"App": "應用程式",
@@ -64,7 +63,6 @@
"Parse": "解析",
"Permission": "權限",
"Permission_tip": "個人權限大於群組權限",
"please_input_name": "請輸入名稱",
"Preview": "預覽",
"Remove": "移除",
"Rename": "重新命名",
@@ -94,6 +92,7 @@
"action_confirm": "確認",
"add_new": "新增",
"add_new_param": "新增參數",
"add_success": "新增成功",
"all_quotes": "全部引用",
"all_result": "完整結果",
"app_not_version": "該應用未發布過,請先發布應用",
@@ -961,6 +960,7 @@
"permission.manager": "管理員",
"permission.read": "讀取權限",
"permission.write": "寫入權限",
"please_input_name": "請輸入名稱",
"plugin.App": "選擇應用程式",
"plugin.Currentapp": "目前應用程式",
"plugin.Description": "描述",
@@ -1259,7 +1259,7 @@
"user.no_usage_records": "無使用紀錄",
"user.old_password": "舊密碼",
"user.password_message": "密碼最少 4 位最多 60 位",
"user.password_tip": "密碼至少 6 位,且至少包含兩種組合:數字、字母或特殊字元",
"user.password_tip": "密碼至少 8 位,且至少包含兩種組合:數字、字母或特殊字元",
"user.reset_password": "重置密碼",
"user.reset_password_tip": "未設置初始密碼/長時間未修改密碼,請重置密碼",
"user.team.Balance": "團隊餘額",

View File

@@ -8,7 +8,7 @@
"login_success": "登入成功",
"no_remind": "不再提醒",
"password_condition": "密碼最多 60 個字元",
"password_tip": "密碼至少 6 位,且至少包含兩種組合:數字、字母或特殊字元",
"password_tip": "密碼至少 8 位,且至少包含兩種組合:數字、字母或特殊字元",
"policy_tip": "使用即代表您同意我們的",
"privacy": "隱私權政策",
"privacy_policy": "隱私權政策",

View File

@@ -4,8 +4,8 @@ import { checkPasswordRule } from '@fastgpt/global/common/string/password';
describe('PasswordRule', () => {
it('should be a valid password', () => {
// Small password
expect(checkPasswordRule('123A')).toBe(false);
expect(checkPasswordRule('@ga21')).toBe(false);
expect(checkPasswordRule('123ABC')).toBe(false);
expect(checkPasswordRule('@ga2123')).toBe(false);
// Test single type characters
expect(checkPasswordRule('123456')).toBe(false);
@@ -14,13 +14,13 @@ describe('PasswordRule', () => {
expect(checkPasswordRule('!@#$%^')).toBe(false); // only special chars
// Test two types combination
expect(checkPasswordRule('abc123')).toBe(true); // lowercase + numbers
expect(checkPasswordRule('abcABC')).toBe(true); // lowercase + uppercase
expect(checkPasswordRule('abc!@#')).toBe(true); // lowercase + special chars
expect(checkPasswordRule('ABC!@#')).toBe(true); // uppercase + special chars
expect(checkPasswordRule('ABC123')).toBe(true); // uppercase + numbers
expect(checkPasswordRule('123!@#')).toBe(true); // numbers + special chars
expect(checkPasswordRule('!@123fa')).toBe(true); // numbers + special chars
expect(checkPasswordRule('abcd1234')).toBe(true); // lowercase + numbers
expect(checkPasswordRule('abcdABCD')).toBe(true); // lowercase + uppercase
expect(checkPasswordRule('abcd!@#$')).toBe(true); // lowercase + special chars
expect(checkPasswordRule('ABCD!@#$')).toBe(true); // uppercase + special chars
expect(checkPasswordRule('ABCD1234')).toBe(true); // uppercase + numbers
expect(checkPasswordRule('1234!@#$')).toBe(true); // numbers + special chars
expect(checkPasswordRule('!@123fab')).toBe(true); // numbers + special chars
expect(checkPasswordRule('+2222()222')).toBe(true); // special chars + numbers
expect(checkPasswordRule('_2222()-+=22')).toBe(true); // special chars + numbers