recover_pass_request.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:wiggum 作者: qdqmedia 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号