def process_request(self, request): session_key = conf.get("SESSION_KEY") secret = conf.get("SECRET") value = request.get_signed_cookie(session_key, default=None) path_info = request.path_info.strip("/") if value != secret: return views.stage(request) elif path_info == conf.get("RESET_URL").strip("/"): response = redirect("/") response.delete_cookie(session_key) return response
def clean_secret(self): value = self.cleaned_data['secret'] if value != conf.get("SECRET"): raise forms.ValidationError("Oops! you have entered an invalid secret. Please try again") return value