Browse Source

登陆密码正则表达式更正,支持6-18位包含数字、字母和特殊字符&支持国际化提示

wanghao 4 months ago
parent
commit
54f4bc516c
3 changed files with 4 additions and 4 deletions
  1. 2 2
      src/constants/reg.ts
  2. 1 1
      src/locales/langs/en-us.ts
  3. 1 1
      src/locales/langs/zh-cn.ts

+ 2 - 2
src/constants/reg.ts

@@ -7,9 +7,9 @@ export const REG_PHONE =
 /**
  * Password reg
  *
- * 6-18 characters, including letters, numbers, and underscores
+ * 6-18 characters, including letters, numbers, and special characters
  */
-export const REG_PWD = /^[\w@!#&*]{6,18}$/;
+export const REG_PWD = /^(?=.*[A-Za-z])(?=.*\d)(?=.*[!@#$%^&*()_+])[A-Za-z\d!@#$%^&*()_+]{6,18}$/;
 
 /** Email reg */
 export const REG_EMAIL = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;

+ 1 - 1
src/locales/langs/en-us.ts

@@ -440,7 +440,7 @@ const local: App.I18n.Schema = {
     },
     pwd: {
       required: 'Please enter password',
-      invalid: '6-18 characters, including letters, numbers, and underscores'
+      invalid: '6-18 characters, including letters, numbers, and special characters'
     },
     confirmPwd: {
       required: 'Please enter password again',

+ 1 - 1
src/locales/langs/zh-cn.ts

@@ -449,7 +449,7 @@ const local: App.I18n.Schema = {
     },
     pwd: {
       required: '请输入密码',
-      invalid: '密码格式不正确,6-18位字符,包含字母、数字、下划线'
+      invalid: '密码格式不正确,6-18位字符,包含字母、数字、特殊字符'
     },
     confirmPwd: {
       required: '请输入确认密码',