|
@@ -2426,15 +2426,20 @@ class Image_Code_RegisterView(TemplateView):
|
|
|
phoneValid = Device_User.objects.filter(phone=phone)
|
|
|
if phoneValid:
|
|
|
return response.json(101)
|
|
|
- #key
|
|
|
- image_code_id = "image_code_%s" %imageCodeId
|
|
|
+ #根据uuid拼接的key
|
|
|
+ image_code_key = "image_code_%s" %imageCodeId
|
|
|
+ #判断验证码是否过期
|
|
|
+ if image_code_key is None:
|
|
|
+ return response.json(120)
|
|
|
redisObj = RedisObject(db=6)
|
|
|
+
|
|
|
#redis里面的验证码
|
|
|
- redis_image_code = redisObj.get_data(key=image_code_id)
|
|
|
+ redis_image_code = redisObj.get_data(key=image_code_key)
|
|
|
+ #验证用户输入的验证码和redis中的验证码
|
|
|
if not valid_code==redis_image_code:
|
|
|
return response.json(121)
|
|
|
- # return response.json(0)
|
|
|
- #print
|
|
|
+ # 删除redis中的图片验证码,防止用户使用同一个图片验证码验证多次
|
|
|
+ redisObj.del_data(key=image_code_key)
|
|
|
# #存用户名和密码
|
|
|
create_data = {
|
|
|
"phone":phone,
|