|
@@ -372,7 +372,7 @@ class ForgetPwdView(TemplateView):
|
|
|
return self.ValidationError(userName, response)
|
|
|
|
|
|
def ValidationError(self, userName, response):
|
|
|
-
|
|
|
+ return response.json()
|
|
|
if userName != None:
|
|
|
userName = userName.strip()
|
|
|
return self.ForgetPwd(userName, response)
|
|
@@ -444,32 +444,27 @@ class EmailResetPwdView(TemplateView):
|
|
|
|
|
|
def validate(self, request_dict, response, *args, **kwargs):
|
|
|
token = request_dict.get('token', None)
|
|
|
- if token is not None:
|
|
|
- tko = TokenObject(token)
|
|
|
- if tko.code == 0:
|
|
|
- redisObj = RedisObject()
|
|
|
- userID = tko.userID
|
|
|
- reset_pwd = redisObj.get_data(key=userID + '_email_reset_pwd')
|
|
|
- if reset_pwd is not False:
|
|
|
- user_qs = Device_User.objects.filter(userID=userID)
|
|
|
- if user_qs.exists():
|
|
|
- redisObj.del_data(key=userID + '_email_reset_pwd')
|
|
|
- is_update = user_qs.update(password=make_password(reset_pwd))
|
|
|
- if is_update:
|
|
|
- return HttpResponseRedirect(
|
|
|
- "http://www.dvema.com/web/html/paw_update_success.html?code=" + reset_pwd)
|
|
|
- else:
|
|
|
- return response.json(10)
|
|
|
+ tko = TokenObject(token)
|
|
|
+ if tko.code == 0:
|
|
|
+ redisObj = RedisObject()
|
|
|
+ userID = tko.userID
|
|
|
+ reset_pwd = redisObj.get_data(key=userID + '_email_reset_pwd')
|
|
|
+ if reset_pwd is not False:
|
|
|
+ user_qs = Device_User.objects.filter(userID=userID)
|
|
|
+ if user_qs.exists():
|
|
|
+ redisObj.del_data(key=userID + '_email_reset_pwd')
|
|
|
+ is_update = user_qs.update(password=make_password(reset_pwd))
|
|
|
+ if is_update:
|
|
|
+ return HttpResponseRedirect(
|
|
|
+ "http://www.dvema.com/web/html/paw_update_success.html?code=" + reset_pwd)
|
|
|
else:
|
|
|
- return response.json(104)
|
|
|
+ return response.json(10)
|
|
|
else:
|
|
|
- return HttpResponseRedirect('http://www.dvema.com/web/html/paw_update_unsuccessful.html?lang=en')
|
|
|
- return response.json(306, 'rpwd')
|
|
|
+ return response.json(104)
|
|
|
else:
|
|
|
return HttpResponseRedirect('http://www.dvema.com/web/html/paw_update_unsuccessful.html?lang=en')
|
|
|
- return response.json(tko.code)
|
|
|
else:
|
|
|
- return response.json(444, 'token')
|
|
|
+ return HttpResponseRedirect('http://www.dvema.com/web/html/paw_update_unsuccessful.html?lang=en')
|
|
|
|
|
|
|
|
|
class refreshTokenView(TemplateView):
|