def forgot_password(request, form_class=ForgotPasswordForm, template_name="account/forgot_password.html", success_url=None): sent_email = None if success_url is None: success_url = get_default_redirect(request) if request.method == "POST": form = form_class(request.POST) if form.is_valid(): subject = _("Tintz - Nova Senha") message = render_to_string(u"account/password_reset_message.txt", { "user": form.user, "new_password": form.new_password, }) email_password = EmailHtml(subject, message, settings.DEFAULT_FROM_EMAIL, [form.email_address.email]) email_password.start() sent_email = u"Nova senha enviada para o email informado" else: form = form_class() return render_to_response(template_name, { "form": form, "sent_email": sent_email, }, context_instance=RequestContext(request))