def update_pass(request): try: otp = request.POST['otp'] password = request.POST['password'] utils.update_pass(otp, password) logger.info('Password has been updated.') return HttpResponseRedirect('/aftersell/asc/login?update=true') except: logger.error('Password update failed.') return HttpResponseRedirect('/aftersell/asc/login?error=true')
def update_pass(request): try: otp = request.POST['otp'] password = request.POST['password'] data = utils.update_pass(otp, password) return HttpResponse(json.dumps(data), content_type='application/json') except: logger.error('Password update failed.') return HttpResponseRedirect('/aftersell/asc/login?error=true')
def test_save_pass(self): phone_number = '1234567890' password='******' token = get_token(self.asc_user_profile, phone_number) self.assertTrue(isinstance(token, int)) self.assertTrue(update_pass(token, password))