From 97bdeed97a45894a3c247d192bb11395494f6385 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20P=C3=A9pin?= Date: Sat, 5 Sep 2020 23:51:55 +0200 Subject: [PATCH] Prevent a crash in exte login form error handling --- gestioncof/views.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gestioncof/views.py b/gestioncof/views.py index c80eda6c..9c9dfd3c 100644 --- a/gestioncof/views.py +++ b/gestioncof/views.py @@ -92,9 +92,7 @@ class LoginExtView(DjangoLoginView): form_class = ExteAuthenticationForm def form_invalid(self, form): - # forms.non_field_errors() returns strings for some reason - non_field_errors = form.errors["__all__"].as_data() - for e in non_field_errors: + for e in form.non_field_errors().as_data(): if e.code in ["has_clipper", "no_password"]: return render(self.request, "login_error.html", {"error_code": e.code}) return super().form_invalid(form)