diff options
author | Andrew Godwin | 2022-12-15 16:23:54 -0700 |
---|---|---|
committer | Andrew Godwin | 2022-12-15 16:24:06 -0700 |
commit | bce7add2b4c9e8e0182db1ff6b2dadec2c14ca50 (patch) | |
tree | e41f158e59c15cbd312655f8d00f56d3935419a6 | |
parent | 1a7ffb4bff69aa32dc898c650215cba405031202 (diff) | |
download | takahe-bce7add2b4c9e8e0182db1ff6b2dadec2c14ca50.tar.gz takahe-bce7add2b4c9e8e0182db1ff6b2dadec2c14ca50.tar.bz2 takahe-bce7add2b4c9e8e0182db1ff6b2dadec2c14ca50.zip |
Fix login form errors not appearing
Fixes #175
-rw-r--r-- | static/css/style.css | 10 | ||||
-rw-r--r-- | templates/auth/login.html | 3 | ||||
-rw-r--r-- | users/views/auth.py | 7 |
3 files changed, 20 insertions, 0 deletions
diff --git a/static/css/style.css b/static/css/style.css index 9b509b8..4160d26 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -221,6 +221,10 @@ header menu a.identity { width: 250px; } +body.no-sidebar header menu a.identity { + display: none; +} + header menu a.identity i { display: inline-block; vertical-align: middle; @@ -289,11 +293,13 @@ nav a i { .columns { display: flex; align-items: stretch; + justify-content: center; } .left-column { flex-grow: 1; width: 300px; + max-width: 700px; padding: 15px; } @@ -315,6 +321,10 @@ nav a i { border-radius: 0 0 5px 0; } +body.no-sidebar .right-column { + display: none; +} + .right-column h2 { background: var(--color-highlight); padding: 8px 10px; diff --git a/templates/auth/login.html b/templates/auth/login.html index 96c0e98..a0588a9 100644 --- a/templates/auth/login.html +++ b/templates/auth/login.html @@ -2,11 +2,14 @@ {% block title %}Login{% endblock %} +{% block body_class %}no-sidebar{% endblock %} + {% block content %} <form action="." method="POST"> {% csrf_token %} <fieldset> <legend>Login</legend> + {{ form.non_field_errors }} {% for field in form %} {% include "forms/_field.html" %} {% endfor %} 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" |