def do(self, action_context, view, email, *args, **kwargs):
user = action_context.extra_context.get('user')
if not user:
msg = _("We haven't found any account with email {0}").format(email)
messages.add_message(action_context.request, messages.ERROR, msg)
logger.info(("Recover password not sent to {0} (email not found)"
).format(email))
# Set the initial form with the next value
uri = get_redirect_url(action_context.request) # Get the uri from the url first
if not uri:
form = action_context.extra_context["form"]
# Try second time from the form
uri = form.get_redirect_uri()
form = view.get_form_class()(initial={
'redirect_uri': uri})
action_context.response = view.render_to_response(
view.get_context_data(form=form))
action_context.break_chain = True
return super().do(action_context, view, email, *args, **kwargs)
评论列表
文章目录