|
@@ -2462,16 +2462,16 @@ class Image_Code_RegisterView(TemplateView):
|
|
|
#检测验证码,并注册
|
|
|
def validates(self,request_dict):
|
|
|
print("__________request_dict:%s" % request_dict)
|
|
|
- phone = request_dict.get('phone',None)
|
|
|
userEmail = request_dict.get('userEmail',None)
|
|
|
password = request_dict.get('userPwd',None)
|
|
|
- language = request_dict.get('language',None)
|
|
|
+ lang = request_dict.get('lang',None)
|
|
|
#前端传进来的uuid
|
|
|
imageCodeId = request_dict.get('imageCodeId',None)
|
|
|
# 页面输入的验证码
|
|
|
- response = ResponseObject(language)
|
|
|
+ response = ResponseObject(lang)
|
|
|
valid_code = request_dict.get('id_v_code', None)
|
|
|
- if not all([phone, userEmail, password, language, imageCodeId, valid_code]):
|
|
|
+
|
|
|
+ if not all([userEmail, password, lang, imageCodeId, valid_code]):
|
|
|
return response.json(444)
|
|
|
try:
|
|
|
for i in range(1, 4):
|
|
@@ -2487,7 +2487,6 @@ class Image_Code_RegisterView(TemplateView):
|
|
|
password = base64.b64decode(password)
|
|
|
password = password.decode('utf-8')
|
|
|
password = password[3:-3]
|
|
|
- # print(password)
|
|
|
except Exception as e:
|
|
|
return response.json(111)
|
|
|
try:
|
|
@@ -2504,14 +2503,13 @@ class Image_Code_RegisterView(TemplateView):
|
|
|
valid_code = base64.b64decode(valid_code)
|
|
|
valid_code = valid_code.decode('utf-8')
|
|
|
valid_code = valid_code[3:-3]
|
|
|
+ print(valid_code)
|
|
|
except Exception as e:
|
|
|
return response.json(121)
|
|
|
if not userEmail:
|
|
|
return response.json(105)
|
|
|
if not password:
|
|
|
return response.json(109)
|
|
|
- if not phone:
|
|
|
- return response.json(100)
|
|
|
userEmail = userEmail.strip()
|
|
|
password = password.strip()
|
|
|
# 注释
|
|
@@ -2519,10 +2517,6 @@ class Image_Code_RegisterView(TemplateView):
|
|
|
emailValid = Device_User.objects.filter(userEmail=userEmail)
|
|
|
if emailValid:
|
|
|
return response.json(103)
|
|
|
- if phone:
|
|
|
- phoneValid = Device_User.objects.filter(phone=phone)
|
|
|
- if phoneValid:
|
|
|
- return response.json(101)
|
|
|
#根据uuid拼接的key
|
|
|
image_code_key = "image_code_%s" %imageCodeId
|
|
|
#判断验证码是否过期
|
|
@@ -2536,10 +2530,9 @@ class Image_Code_RegisterView(TemplateView):
|
|
|
return response.json(121)
|
|
|
# 删除redis中的图片验证码,防止用户使用同一个图片验证码验证多次
|
|
|
redisObj.del_data(key=image_code_key)
|
|
|
- username = phone
|
|
|
+ username = userEmail
|
|
|
# #存用户名和密码
|
|
|
create_data = {
|
|
|
- "phone":phone,
|
|
|
"username": username,
|
|
|
"NickName": username,
|
|
|
"userEmail": userEmail,
|
|
@@ -2548,6 +2541,7 @@ class Image_Code_RegisterView(TemplateView):
|
|
|
"is_active": True,
|
|
|
"user_isValid": True,
|
|
|
}
|
|
|
+ print("bbbb")
|
|
|
users = Device_User.objects.create(**create_data)
|
|
|
return response.json(0)
|
|
|
|