Permet de passer un formulaire personnalisé pour la réinitialisation de mdp

This commit is contained in:
Tom Hubrecht 2021-06-10 11:07:54 +02:00
parent f24395ea41
commit 61b8f1f7b9

View file

@ -3,6 +3,7 @@ from urllib.parse import urlparse, urlunparse
from django.conf import settings
from django.contrib import auth
from django.contrib.auth import views as auth_views
from django.contrib.auth.forms import PasswordResetForm
from django.contrib.messages.views import SuccessMessageMixin
from django.core.exceptions import PermissionDenied
from django.shortcuts import redirect
@ -101,6 +102,9 @@ class PasswordResetView(SuccessMessageMixin, auth_views.PasswordResetView):
subject_template_name = "authens/pwd_reset_subject.txt"
success_url = reverse_lazy("authens:login")
def get_form_class(self):
return getattr(settings, "AUTHENS_PWD_RESET_FORM", PasswordResetForm)
success_message = _(
"Un email de réinitialisation vient d'être envoyé à l'adresse indiquée !"
)