From 53e023f9aea6cc08f66eaada9abd894a58d8e128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sch=C3=A4fer?= Date: Sat, 6 Feb 2021 11:14:28 +0100 Subject: [PATCH] Protect against invalid domain on the client side Here we protect the user from themselves if they accidentally enter their snikket credentials into the wrong instance by preventing the form from even being submitted and by showing a nice error message. --- snikket_web/templates/login.html | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/snikket_web/templates/login.html b/snikket_web/templates/login.html index 93a135f..5f6b431 100644 --- a/snikket_web/templates/login.html +++ b/snikket_web/templates/login.html @@ -12,13 +12,17 @@

{{ config["SITE_NAME"] }}

{{ _("Enter your Snikket address and password to manage your account.") }}

-
+ {{ form.csrf_token }} {% if form.errors %} {% call box("alert", _("Login failed")) %}

{{ form.errors.values() | flatten | join(", ")}}

{% endcall %} {% endif %} +
{{ form.address.label(class="a11y-only") }} {{ form.address(placeholder=form.address.label.text) }} @@ -31,6 +35,22 @@ {%- call form_button("login", form.action_signin, class="primary") -%}{% endcall -%}
+
{%- include "_footer.html" -%} {% endblock %}