Exemplo n.º 1
0
    def form_valid(self, form):
        PasswordReset.create(form.user)

        response_kwargs = {
            'request': self.request,
            'template': self.template_name_sent,
            'context': {
                'email': form.user.email,
            }
        }
        html = self.response_class(**response_kwargs)
        html.render()
        return JsonResponse(status=1, data={'html': html.content})
Exemplo n.º 2
0
    def form_valid(self, form):
        PasswordReset.create(form.user)

        if self.request.is_ajax():
            #t = get_template(self.template_name_sent_ajax)
            #t.render(RequestContext(self.request,
            #                        self.get_context_data(form=form)))
            return JsonResponse(status=1, msg=u'重置密码邮件已发送至该邮箱。')

        response_kwargs = {
            'request': self.request,
            'template': self.template_name_sent,
            'context': self.get_context_data(form=form)
        }

        self.template_name = self.template_name_sent
        return self.response_class(**response_kwargs)