def challenge(self, environ, status, app_headers, forget_headers): logger = environ.get("repoze.who.logger", "") logger.info("formplugin challenge") if app_headers: location = LOCATION(app_headers) if location: headers = list(app_headers) + list(forget_headers) return HTTPFound(headers=headers) query = parse_dict_querystring(environ) hidden = [] for key, val in query.items(): hidden.append(HIDDEN_PRE_LINE % ("_%s_" % key, val)) logger.info("hidden: %s", hidden) form = self.formbody or _DEFAULT_FORM form = form % "\n".join(hidden) if self.formcallable is not None: form = self.formcallable(environ) def auth_form(environ, start_response): content_length = CONTENT_LENGTH.tuples(str(len(form))) content_type = CONTENT_TYPE.tuples("text/html") headers = content_length + content_type + forget_headers start_response("200 OK", headers) return [form] return auth_form
def challenge(self, environ, status, app_headers, forget_headers): if app_headers: location = LOCATION(app_headers) if location: headers = list(app_headers) + list(forget_headers) return HTTPFound(headers = headers) form = self.formbody or _DEFAULT_FORM if self.formcallable is not None: form = self.formcallable(environ) def auth_form(environ, start_response): content_length = CONTENT_LENGTH.tuples(str(len(form))) content_type = CONTENT_TYPE.tuples('text/html') headers = content_length + content_type + forget_headers start_response('200 OK', headers) return [form] return auth_form