PasswordResetView does not send email

0

I'm doing a project where I'm using the Views based on Django classes.

More specifically, I'm using Views to reset my password. Here are my codes:

    # View de exibição do formulário
    class passwordResetView(PasswordResetView):
            """ View utilizada para recuperação de senha. """
            template_name = 'portal/password_reset_form.html'
            subject_template_name = 'portal/password_reset_subject.txt'
            email_template_name = 'portal/password_reset_email.html'
            form_class = passwordResetForm
            success_url = reverse_lazy('portal:passwordResetDone')
            from_email = '[email protected]'
    passwordReset = passwordResetView.as_view()


    # Configuração das URLs
    app_name = 'portal'
    urlpatterns = [
            path('', index, name='index'),
            path('password-reset', passwordReset, name='passwordReset'),
            path('password-reset/done', passwordResetDone, name='passwordResetDone'),
            path('reset/<uidb64>/<token>/', passwordResetConfirm, name='passwordResetConfirm')
        ]


    # Formulário utilizado
    class passwordResetForm(PasswordResetForm):
        """ Formulário utilizado para recuperação de senha. """
        def __init__(self, *args, **kwargs):
            kwargs.setdefault('label_suffix', '')
            super(passwordResetForm, self).__init__(*args, **kwargs)


    # Backend utilizada para debug dos e-mails (no settings.py):
    EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

I have all other views created and all the rendering takes place correctly. However, when you enter a valid user email, view redirection occurs, but no email is sent.

What should I do to have the email sent correctly? (in this case, displayed on the console).

    
asked by anonymous 29.05.2018 / 23:07

0 answers