Browse Source

判断是否传参

peng 1 year ago
parent
commit
17625f6bfa
1 changed files with 13 additions and 13 deletions
  1. 13 13
      Controller/UserController.py

+ 13 - 13
Controller/UserController.py

@@ -370,8 +370,8 @@ class ChangePwdView(TemplateView):
         if password_version == 'V1':
             c_p = check_password(oldPwd, user_qs[0].password)
         else:
-            if not iterations and old_salt:
-                return response.json(111)
+            if not all([iterations, old_salt]):
+                return response.json(444)
             oldPwd = "%s$%d$%s$%s" % ("pbkdf2_sha256", int(iterations), old_salt, oldPwd)
             c_p = CommonService.check_password(oldPwd, user_qs[0].password)
         # 密码是否正确
@@ -463,8 +463,8 @@ class v3ChangePwdView(TemplateView):
         if password_version == 'V1':
             c_p = check_password(oldPwd, user_qs[0].password)
         else:
-            if not iterations and old_salt:
-                return response.json(111)
+            if not all([iterations, old_salt]):
+                return response.json(444)
             oldPwd = "%s$%d$%s$%s" % ("pbkdf2_sha256", int(iterations), old_salt, oldPwd)
             c_p = CommonService.check_password(oldPwd, user_qs[0].password)
         # 密码是否正确
@@ -789,8 +789,8 @@ class refreshTokenViewV3(TemplateView):
                     if not check_password(password, list(user_qs)[0]['password']):
                         return response.json(111)
                 else:
-                    if not iterations and salt:
-                        return response.json(111)
+                    if not all([iterations, salt]):
+                        return response.json(444)
                     password = "%s$%d$%s$%s" % ("pbkdf2_sha256", int(iterations), salt, password)
                     if not CommonService.check_password(password, list(user_qs)[0]['password']):
                         return response.json(111)
@@ -2047,8 +2047,8 @@ class v2LoginView(TemplateView):
         if password_version == 'V1':
             check_flag = check_password(password, users['password'])
         else:
-            if not iterations and salt:
-                return response.json(111)
+            if not all([iterations, salt]):
+                return response.json(444)
             password = "%s$%d$%s$%s" % ("pbkdf2_sha256", int(iterations), salt, password)
             check_flag = CommonService.check_password(password, users['password'])
         if not check_flag:
@@ -2276,7 +2276,7 @@ class v3LoginView(TemplateView):
             check_flag = check_password(password, users['password'])
         else:
             if not all([iterations, salt]):
-                return response.json(111)
+                return response.json(444)
             password = "%s$%d$%s$%s" % ("pbkdf2_sha256", int(iterations), salt, password)
             check_flag = CommonService.check_password(password, users['password'])
         if not check_flag:
@@ -3372,8 +3372,8 @@ class alexaAuthView(TemplateView):
         if password_version == 'V1':
             check_flag = check_password(password, users['password'])
         else:
-            if not iterations and salt:
-                return response.json(111)
+            if not all([iterations, salt]):
+                return response.json(444)
             password = "%s$%d$%s$%s" % ("pbkdf2_sha256", int(iterations), salt, password)
             check_flag = CommonService.check_password(password, users['password'])
         if not check_flag:
@@ -4578,8 +4578,8 @@ def deleteAccount(request):
         if password_version == 'V1':
             check_flag = check_password(password, userPWD['password'])
         else:
-            if not iterations and salt:
-                return response.json(111)
+            if not all([iterations, salt]):
+                return response.json(444)
             password = "%s$%d$%s$%s" % ("pbkdf2_sha256", int(iterations), salt, password)
             check_flag = CommonService.check_password(password, userPWD['password'])
         if not check_flag: