|
@@ -201,6 +201,8 @@ class registerView(TemplateView):
|
|
|
re_flag = dataValid.password_validate(password)
|
|
|
else:
|
|
|
re_flag = True
|
|
|
+ if not salt:
|
|
|
+ return response.json(111)
|
|
|
password = "%s$%d$%s$%s" % ("pbkdf2_sha256", 260000, salt, password)
|
|
|
if re_flag:
|
|
|
if dataValid.email_validate(username):
|
|
@@ -368,7 +370,9 @@ class ChangePwdView(TemplateView):
|
|
|
if password_version == 'V1':
|
|
|
c_p = check_password(oldPwd, user_qs[0].password)
|
|
|
else:
|
|
|
- oldPwd = "%s$%d$%s$%s" % ("pbkdf2_sha256", iterations, old_salt, oldPwd)
|
|
|
+ if not iterations and old_salt:
|
|
|
+ return response.json(111)
|
|
|
+ oldPwd = "%s$%d$%s$%s" % ("pbkdf2_sha256", int(iterations), old_salt, oldPwd)
|
|
|
c_p = CommonService.check_password(oldPwd, user_qs[0].password)
|
|
|
# 密码是否正确
|
|
|
if not c_p:
|
|
@@ -376,6 +380,8 @@ class ChangePwdView(TemplateView):
|
|
|
if password_version == 'V1':
|
|
|
newPwd = make_password(newPwd)
|
|
|
else:
|
|
|
+ if not new_salt:
|
|
|
+ return response.json(111)
|
|
|
newPwd = "%s$%d$%s$%s" % ("pbkdf2_sha256", 260000, new_salt, newPwd)
|
|
|
update = user_qs.update(password=newPwd)
|
|
|
if update:
|
|
@@ -457,7 +463,9 @@ class v3ChangePwdView(TemplateView):
|
|
|
if password_version == 'V1':
|
|
|
c_p = check_password(oldPwd, user_qs[0].password)
|
|
|
else:
|
|
|
- oldPwd = "%s$%d$%s$%s" % ("pbkdf2_sha256", iterations, old_salt, oldPwd)
|
|
|
+ if not iterations and old_salt:
|
|
|
+ return response.json(111)
|
|
|
+ oldPwd = "%s$%d$%s$%s" % ("pbkdf2_sha256", int(iterations), old_salt, oldPwd)
|
|
|
c_p = CommonService.check_password(oldPwd, user_qs[0].password)
|
|
|
# 密码是否正确
|
|
|
if not c_p:
|
|
@@ -465,6 +473,8 @@ class v3ChangePwdView(TemplateView):
|
|
|
if password_version == 'V1':
|
|
|
newPwd = make_password(newPwd)
|
|
|
else:
|
|
|
+ if not new_salt:
|
|
|
+ return response.json(111)
|
|
|
newPwd = "%s$%d$%s$%s" % ("pbkdf2_sha256", 260000, new_salt, newPwd)
|
|
|
update = user_qs.update(password=newPwd)
|
|
|
if update:
|
|
@@ -509,6 +519,8 @@ class createPwd(TemplateView):
|
|
|
password = password[i:-i]
|
|
|
password = make_password(password)
|
|
|
else:
|
|
|
+ if not salt:
|
|
|
+ return response.json(111)
|
|
|
password = "%s$%d$%s$%s" % ("pbkdf2_sha256", 260000, salt, password)
|
|
|
update = Device_User.objects.filter(userID=userID).update(password=password)
|
|
|
if update:
|
|
@@ -777,7 +789,9 @@ class refreshTokenViewV3(TemplateView):
|
|
|
if not check_password(password, list(user_qs)[0]['password']):
|
|
|
return response.json(111)
|
|
|
else:
|
|
|
- password = "%s$%d$%s$%s" % ("pbkdf2_sha256", iterations, salt, password)
|
|
|
+ if not iterations and salt:
|
|
|
+ return response.json(111)
|
|
|
+ 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)
|
|
|
now_time = datetime.datetime.utcnow().replace(tzinfo=utc).astimezone(utc)
|
|
@@ -1067,6 +1081,8 @@ class v2registerView(TemplateView):
|
|
|
re_flag = data_valid.password_validate(password)
|
|
|
password = make_password(password)
|
|
|
else:
|
|
|
+ if not salt:
|
|
|
+ return response.json(111)
|
|
|
password = "%s$%d$%s$%s" % ("pbkdf2_sha256", 260000, salt, password)
|
|
|
re_flag = True
|
|
|
if re_flag is not True:
|
|
@@ -1144,6 +1160,8 @@ class v2registerView(TemplateView):
|
|
|
re_flag = data_valid.email_validate(email)
|
|
|
password = make_password(password)
|
|
|
else:
|
|
|
+ if not salt:
|
|
|
+ return response.json(111)
|
|
|
password = "%s$%d$%s$%s" % ("pbkdf2_sha256", 260000, salt, password)
|
|
|
re_flag = True
|
|
|
if re_flag is not True:
|
|
@@ -1288,6 +1306,8 @@ class v3registerView(TemplateView):
|
|
|
password = make_password(password)
|
|
|
else:
|
|
|
re_flag = True
|
|
|
+ if not salt:
|
|
|
+ return response.json(111)
|
|
|
password = "%s$%d$%s$%s" % ("pbkdf2_sha256", 260000, salt, password)
|
|
|
if re_flag is not True:
|
|
|
return response.json(109)
|
|
@@ -1364,6 +1384,8 @@ class v3registerView(TemplateView):
|
|
|
password = make_password(password)
|
|
|
else:
|
|
|
re_flag = True
|
|
|
+ if not salt:
|
|
|
+ return response.json(111)
|
|
|
password = "%s$%d$%s$%s" % ("pbkdf2_sha256", 260000, salt, password)
|
|
|
if re_flag is not True:
|
|
|
return response.json(109)
|
|
@@ -1695,6 +1717,8 @@ class v2resetPwdByCodeView(TemplateView):
|
|
|
re_flag = data_valid.password_validate(password)
|
|
|
password = make_password(password)
|
|
|
else:
|
|
|
+ if not salt:
|
|
|
+ return response.json(111)
|
|
|
password = "%s$%d$%s$%s" % ("pbkdf2_sha256", 260000, salt, password)
|
|
|
re_flag = True
|
|
|
if re_flag is not True:
|
|
@@ -1723,6 +1747,8 @@ class v2resetPwdByCodeView(TemplateView):
|
|
|
re_flag = data_valid.password_validate(password)
|
|
|
password = make_password(password)
|
|
|
else:
|
|
|
+ if not salt:
|
|
|
+ return response.json(111)
|
|
|
password = "%s$%d$%s$%s" % ("pbkdf2_sha256", 260000, salt, password)
|
|
|
re_flag = True
|
|
|
if re_flag is not True:
|
|
@@ -1867,6 +1893,8 @@ class v3resetPwdByCodeView(TemplateView):
|
|
|
re_flag = data_valid.password_validate(password)
|
|
|
password = make_password(password)
|
|
|
else:
|
|
|
+ if not salt:
|
|
|
+ return response.json(111)
|
|
|
password = "%s$%d$%s$%s" % ("pbkdf2_sha256", 260000, salt, password)
|
|
|
re_flag = True
|
|
|
if re_flag is not True:
|
|
@@ -1895,6 +1923,8 @@ class v3resetPwdByCodeView(TemplateView):
|
|
|
re_flag = data_valid.password_validate(password)
|
|
|
password = make_password(password)
|
|
|
else:
|
|
|
+ if not salt:
|
|
|
+ return response.json(111)
|
|
|
password = "%s$%d$%s$%s" % ("pbkdf2_sha256", 260000, salt, password)
|
|
|
re_flag = True
|
|
|
if re_flag is not True:
|
|
@@ -2017,7 +2047,9 @@ class v2LoginView(TemplateView):
|
|
|
if password_version == 'V1':
|
|
|
check_flag = check_password(password, users['password'])
|
|
|
else:
|
|
|
- password = "%s$%d$%s$%s" % ("pbkdf2_sha256", iterations, salt, password)
|
|
|
+ if not iterations and salt:
|
|
|
+ return response.json(111)
|
|
|
+ password = "%s$%d$%s$%s" % ("pbkdf2_sha256", int(iterations), salt, password)
|
|
|
check_flag = CommonService.check_password(password, users['password'])
|
|
|
if not check_flag:
|
|
|
return response.json(111)
|
|
@@ -2243,7 +2275,9 @@ class v3LoginView(TemplateView):
|
|
|
if password_version == 'V1':
|
|
|
check_flag = check_password(password, users['password'])
|
|
|
else:
|
|
|
- password = "%s$%d$%s$%s" % ("pbkdf2_sha256", iterations, salt, password)
|
|
|
+ if not iterations and salt:
|
|
|
+ return response.json(111)
|
|
|
+ password = "%s$%d$%s$%s" % ("pbkdf2_sha256", int(iterations), salt, password)
|
|
|
check_flag = CommonService.check_password(password, users['password'])
|
|
|
if not check_flag:
|
|
|
return response.json(111)
|
|
@@ -3179,6 +3213,8 @@ class OauthPerfectView(TemplateView):
|
|
|
re_flag = data_valid.password_validate(password)
|
|
|
password = make_password(password)
|
|
|
else:
|
|
|
+ if not salt:
|
|
|
+ return response.json(111)
|
|
|
password = "%s$%d$%s$%s" % ("pbkdf2_sha256", 260000, salt, password)
|
|
|
re_flag = True
|
|
|
if re_flag is not True:
|
|
@@ -3211,6 +3247,8 @@ class OauthPerfectView(TemplateView):
|
|
|
re_flag = data_valid.password_validate(password)
|
|
|
password = make_password(password)
|
|
|
else:
|
|
|
+ if not salt:
|
|
|
+ return response.json(111)
|
|
|
password = "%s$%d$%s$%s" % ("pbkdf2_sha256", 260000, salt, password)
|
|
|
re_flag = True
|
|
|
if re_flag is not True:
|
|
@@ -3334,7 +3372,9 @@ class alexaAuthView(TemplateView):
|
|
|
if password_version == 'V1':
|
|
|
check_flag = check_password(password, users['password'])
|
|
|
else:
|
|
|
- password = "%s$%d$%s$%s" % ("pbkdf2_sha256", iterations, salt, password)
|
|
|
+ if not iterations and salt:
|
|
|
+ return response.json(111)
|
|
|
+ password = "%s$%d$%s$%s" % ("pbkdf2_sha256", int(iterations), salt, password)
|
|
|
check_flag = CommonService.check_password(password, users['password'])
|
|
|
if not check_flag:
|
|
|
return response.json(111)
|
|
@@ -3699,6 +3739,8 @@ class Image_Code_RegisterView(TemplateView):
|
|
|
password = password[3:-3]
|
|
|
password = make_password(password)
|
|
|
else:
|
|
|
+ if not salt:
|
|
|
+ return response.json(111)
|
|
|
password = "%s$%d$%s$%s" % ("pbkdf2_sha256", 260000, salt, password)
|
|
|
except Exception as e:
|
|
|
print(repr(e))
|
|
@@ -4536,7 +4578,9 @@ def deleteAccount(request):
|
|
|
if password_version == 'V1':
|
|
|
check_flag = check_password(password, userPWD['password'])
|
|
|
else:
|
|
|
- password = "%s$%d$%s$%s" % ("pbkdf2_sha256", iterations, salt, password)
|
|
|
+ if not iterations and salt:
|
|
|
+ return response.json(111)
|
|
|
+ password = "%s$%d$%s$%s" % ("pbkdf2_sha256", int(iterations), salt, password)
|
|
|
check_flag = CommonService.check_password(password, userPWD['password'])
|
|
|
if not check_flag:
|
|
|
return response.json(111)
|