From bce7add2b4c9e8e0182db1ff6b2dadec2c14ca50 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Thu, 15 Dec 2022 16:23:54 -0700 Subject: Fix login form errors not appearing Fixes #175 --- users/views/auth.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'users/views') diff --git a/users/views/auth.py b/users/views/auth.py index acb22b6..02c75e6 100644 --- a/users/views/auth.py +++ b/users/views/auth.py @@ -1,8 +1,10 @@ from django import forms from django.conf import settings +from django.contrib.auth.forms import AuthenticationForm from django.contrib.auth.password_validation import validate_password from django.contrib.auth.views import LoginView, LogoutView from django.shortcuts import get_object_or_404, render +from django.utils.translation import gettext_lazy as _ from django.views.generic import FormView from core.models import Config @@ -10,6 +12,11 @@ from users.models import Invite, PasswordReset, User class Login(LoginView): + class form_class(AuthenticationForm): + error_messages = { + "invalid_login": _("No account was found with that email and password."), + "inactive": _("This account is inactive."), + } template_name = "auth/login.html" -- cgit v1.2.3