Procházet zdrojové kódy

优化密码校验

peng před 1 rokem
rodič
revize
8d51c184e4

+ 1 - 1
Controller/CheckUserData.py

@@ -41,7 +41,7 @@ class DataValid:
         # self.re_name = re.compile(r'^[A-Za-z0-9\u4e00-\u9fa5\.\_]{1,16}$')
         self.re_name = re.compile(r'^[A-Za-z0-9\u4e00-\u9fa5\.\_\-\@]{4,64}$')
         # 密码强度正则
-        self.re_password = re.compile(r'^[\w\.\_\@\-\#\$\%\^\&\+\=]{6,16}$')
+        self.re_password = re.compile(r'^[A-Za-z0-9\.\_\@\-\#\$\%\^\&\+\=\~\!\%\*\(\)\=\+\`\[\]\{\}\;\:\?\,\<\>\|\'\"]{6,16}$')
         # 手机号码正则
         self.re_mobile = re.compile(r'^\d{1,16}$')
         # 邮箱地址正则

+ 3 - 3
Controller/UserController.py

@@ -435,9 +435,9 @@ class v3ChangePwdView(TemplateView):
         else:
             if oldPwd is None or newPwd is None or len(newPwd) < 6:
                 return response.json(111)
-            # data_valid = DataValid()
-            # if not data_valid.password_validate(newPwd):
-            #     return response.json(109)
+            data_valid = DataValid()
+            if not data_valid.password_validate(newPwd):
+                return response.json(109)
             tko = TokenObject(token)
             response.lang = tko.lang
             if tko.code != 0:

+ 2 - 2
Object/ResponseObject.py

@@ -36,7 +36,7 @@ class ResponseObject(object):
             106: 'Illegal profile picture!',
             107: 'The username not conform to the rules!',
             108: 'Illegal nickname!',
-            109: 'Only supports letters, numbers, and special characters._@-#$%^&+=',
+            109: 'Supports 6-16 numbers, English letters, and symbols',
             110: 'user doesn\'t activated',
             111: 'Error password',
             112: 'Fingerprint login is not turned on',
@@ -175,7 +175,7 @@ class ResponseObject(object):
             106: '头像违规!',
             107: '用户名格式不符合!',
             108: '用户昵称违规!',
-            109: '只支持字母,数字,特殊字符._@-#$%^&+=',
+            109: '支持6-16位的数字、英文字母、英文符号',
             110: '用户未激活!',
             111: '密码不正确!',
             112: '未开通指纹登录',