Commit 0379077f authored by Antoine Bernard's avatar Antoine Bernard

[password_reset] fix 'user not defined' introduit dans 4a79b7.

parent d48b3a9c
...@@ -179,7 +179,8 @@ class PasswordResetConfirmView(FormView): ...@@ -179,7 +179,8 @@ class PasswordResetConfirmView(FormView):
form = self.form_class(request.POST) form = self.form_class(request.POST)
# On vérifie le token avant de servir la page. # On vérifie le token avant de servir la page.
if not self.is_token_valid(request, uidb64, token): user = self.is_token_valid(request, uidb64, token)
if user is not None:
return redirect(reverse_lazy("password_reset:password_reset")) return redirect(reverse_lazy("password_reset:password_reset"))
# On vérifie la validité du formulaire # On vérifie la validité du formulaire
...@@ -206,10 +207,10 @@ class PasswordResetConfirmView(FormView): ...@@ -206,10 +207,10 @@ class PasswordResetConfirmView(FormView):
# Si `user` existe et le `token` n'a pas expiré. # Si `user` existe et le `token` n'a pas expiré.
if user is not None and self.token_generator.check_token(user, token): if user is not None and self.token_generator.check_token(user, token):
return True return user
# Sinon # Sinon
messages.error(request, _(u"Le token de réinitialisation n'est plus valide.")) messages.error(request, _(u"Le token de réinitialisation n'est plus valide."))
return False return None
password_reset_confirm = PasswordResetConfirmView.as_view() password_reset_confirm = PasswordResetConfirmView.as_view()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment