def handle_password_reset(self, request, form): request.include("common") request.include("check_password") if form.submitted(request): identity = form.get_identity(request) if identity is not None: response = morepath.redirect(request.link(self)) morepath.remember_identity(response, request, identity) request.success(_("Password changed.")) return response else: request.alert(_("Wrong username or password reset link not valid any more.")) log.info("Failed password reset attempt by {}".format(request.client_addr)) if "token" in request.params: form.token.data = request.params["token"] layout = DefaultLayout(self, request) layout.breadcrumbs = [ Link(_("Homepage"), layout.homepage_url), Link(_("Reset password"), request.link(self, name="request-password")), ] return {"layout": layout, "title": _(u"Reset password"), "form": form, "form_width": "small"}
def remember(response): # This demonstrates that the function is indeed called print('trying to remember {} with {}'.format(username, password)) identity = mp.Identity(username) mp.remember_identity(response, request, identity)
def default(self, request): response = Response() morepath.remember_identity(response, request, Identity('foo'), lookup=request.lookup) return response
def remember(response): identity = Identity(username, fullname=fullname, email=email, role=role) morepath.remember_identity(response, request, identity, lookup=request.lookup)
def remember(response): identity = Identity(username) morepath.remember_identity(response, request, identity, lookup=request.lookup)