def confirm_request_hash(request, task): if request.method == 'GET': d = request.GET elif request.method == 'POST': d = request.POST else: raise http.Http404('Invalid method') # Verify the hash. try: email, email_hash = d['e'], d['h'] if email_hash != utils.make_email_hash(email, task): raise KeyError except KeyError: if task == utils.CREATE_TASK: form_link = reverse(register) elif task == utils.RESET_TASK: form_link = reverse(request_password_change) else: raise KeyError("Unknown task %r" % task) context = RequestContext(request, {'form_link': form_link}) response = http.HttpResponseNotFound(render_to_string('accounts/hash_error.html', context_instance=context)) raise BadHash(response) return email, email_hash
def confirm_request_hash(request, task): if request.method == 'GET': d = request.GET elif request.method == 'POST': d = request.POST else: raise http.Http404('Invalid method') # Verify the hash. try: email, email_hash = d['e'], d['h'] if email_hash != utils.make_email_hash(email, task): raise KeyError except KeyError: if task == utils.CREATE_TASK: form_link = reverse(register) elif task == utils.RESET_TASK: form_link = reverse(request_password_change) else: raise KeyError("Unknown task %r" % task) context = RequestContext(request, {'form_link': form_link}) response = http.HttpResponseNotFound( render_to_string('accounts/hash_error.html', context_instance=context)) raise BadHash(response) return email, email_hash
def confirm_request_hash(request, task): if request.method == 'GET': d = request.GET elif request.method == 'POST': d = request.POST else: raise http.Http404('Invalid method') # Verify the hash. try: email, email_hash = d['e'], d['h'] if email_hash != utils.make_email_hash(email, task): raise KeyError except KeyError: form_link = {utils.CREATE_TASK: '/accounts/register/', utils.RESET_TASK: '/accounts/password-change/'}[task] response = http.HttpResponseNotFound(render_to_string('accounts/hash_error.html', {'form_link': form_link})) raise BadHash(response) return email, email_hash
def confirm_request_hash(request, task): if request.method == 'GET': d = request.GET elif request.method == 'POST': d = request.POST else: raise http.Http404('Invalid method') # Verify the hash. try: email, email_hash = d['e'], d['h'] if email_hash != utils.make_email_hash(email, task): raise KeyError except KeyError: form_link = { utils.CREATE_TASK: '/accounts/register/', utils.RESET_TASK: '/accounts/password-change/' }[task] response = http.HttpResponseNotFound( render_to_string('accounts/hash_error.html', {'form_link': form_link})) raise BadHash(response) return email, email_hash