UI improvement on forgotten password page. Fixes #43

This commit is contained in:
Éloi Rivard 2021-01-01 15:29:55 +01:00
parent 58158b902d
commit 8d9a11a2e4
6 changed files with 65 additions and 49 deletions

View file

@ -21,6 +21,7 @@ Added
- Admin user page. :issue:`8` - Admin user page. :issue:`8`
- Project logo. :pr:`29` - Project logo. :pr:`29`
- Admins can impersonate users. :issue:`39` - Admins can impersonate users. :issue:`39`
- Forgotten page UX improvement. :pr:`43`
- Admins can remove clients. :pr:`45` - Admins can remove clients. :pr:`45`
- Option `HIDE_INVALID_LOGIN` that can be unactivated to let the user know if - Option `HIDE_INVALID_LOGIN` that can be unactivated to let the user know if
the login he attempt to sign in with exists or not. :pr:`48` the login he attempt to sign in with exists or not. :pr:`48`

View file

@ -33,7 +33,13 @@
{{ form.hidden_tag() if form.hidden_tag }} {{ form.hidden_tag() if form.hidden_tag }}
{{ sui.render_field(form.login, icon="user") }} {{ sui.render_field(form.login, icon="user") }}
<button type="submit" class="ui right floated primary button">{{ _("Send") }}</button> <button type="submit" class="ui right floated {% if request.method == "POST" and not form.errors %}primary {% endif %}button">
{% if request.method == "POST" %}
{{ _("Send again") }}
{% else %}
{{ _("Send") }}
{% endif %}
</button>
<a type="button" class="ui right floated button" href="{{ url_for('canaille.account.login') }}">{{ _("Login page") }}</a> <a type="button" class="ui right floated button" href="{{ url_for('canaille.account.login') }}">{{ _("Login page") }}</a>
</form> </form>
</div> </div>

View file

@ -2,14 +2,14 @@
# Copyright (C) 2020 ORGANIZATION # Copyright (C) 2020 ORGANIZATION
# This file is distributed under the same license as the PROJECT project. # This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2020. # FIRST AUTHOR <EMAIL@ADDRESS>, 2020.
# Éloi Rivard <eloi@yaal.fr>, 2020. # Éloi Rivard <eloi@yaal.fr>, 2020-2021.
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PROJECT VERSION\n" "Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: contact@yaal.fr\n" "Report-Msgid-Bugs-To: contact@yaal.fr\n"
"POT-Creation-Date: 2020-12-31 19:41+0100\n" "POT-Creation-Date: 2021-01-01 15:28+0100\n"
"PO-Revision-Date: 2020-12-31 19:42+0100\n" "PO-Revision-Date: 2021-01-01 15:29+0100\n"
"Last-Translator: Éloi Rivard <eloi@yaal.fr>\n" "Last-Translator: Éloi Rivard <eloi@yaal.fr>\n"
"Language: fr_FR\n" "Language: fr_FR\n"
"Language-Team: French - France <equipe@yaal.fr>\n" "Language-Team: French - France <equipe@yaal.fr>\n"
@ -111,81 +111,81 @@ msgstr "Impossible de supprimer cet accès."
msgid "The access has been revoked" msgid "The access has been revoked"
msgstr "L'accès a été révoqué." msgstr "L'accès a été révoqué."
#: canaille/forms.py:12 canaille/forms.py:32 #: canaille/forms.py:12 canaille/forms.py:37
msgid "Login" msgid "Login"
msgstr "Identifiant" msgstr "Identifiant"
#: canaille/forms.py:15 canaille/forms.py:35 canaille/forms.py:83 #: canaille/forms.py:15 canaille/forms.py:40 canaille/forms.py:96
msgid "jane@doe.com" msgid "jane@doe.com"
msgstr "martin@dupont.fr" msgstr "martin@dupont.fr"
#: canaille/forms.py:22 canaille/forms.py:44 canaille/forms.py:93 #: canaille/forms.py:22 canaille/forms.py:57 canaille/forms.py:106
msgid "Password" msgid "Password"
msgstr "Mot de passe" msgstr "Mot de passe"
#: canaille/forms.py:28 #: canaille/forms.py:31 canaille/forms.py:51
msgid "The login '{login}' does not exist" msgid "The login '{login}' does not exist"
msgstr "L'identifiant '{login}' n'existe pas" msgstr "L'identifiant '{login}' n'existe pas"
#: canaille/forms.py:47 canaille/forms.py:97 #: canaille/forms.py:60 canaille/forms.py:110
msgid "Password confirmation" msgid "Password confirmation"
msgstr "Confirmation du mot de passe" msgstr "Confirmation du mot de passe"
#: canaille/forms.py:50 canaille/forms.py:100 #: canaille/forms.py:63 canaille/forms.py:113
msgid "Password and confirmation do not match." msgid "Password and confirmation do not match."
msgstr "Le mot de passe et sa confirmation ne correspondent pas." msgstr "Le mot de passe et sa confirmation ne correspondent pas."
#: canaille/forms.py:58 #: canaille/forms.py:71
msgid "Username" msgid "Username"
msgstr "Identifiant" msgstr "Identifiant"
#: canaille/forms.py:59 #: canaille/forms.py:72
msgid "jdoe" msgid "jdoe"
msgstr "mdupont" msgstr "mdupont"
#: canaille/admin/clients.py:23 canaille/forms.py:62 #: canaille/admin/clients.py:23 canaille/forms.py:75
#: canaille/templates/admin/client_list.html:25 #: canaille/templates/admin/client_list.html:25
#: canaille/templates/users.html:22 #: canaille/templates/users.html:22
msgid "Name" msgid "Name"
msgstr "Nom" msgstr "Nom"
#: canaille/forms.py:64 #: canaille/forms.py:77
msgid "Given name" msgid "Given name"
msgstr "Prénom" msgstr "Prénom"
#: canaille/forms.py:66 #: canaille/forms.py:79
msgid "John" msgid "John"
msgstr "Martin" msgstr "Martin"
#: canaille/forms.py:72 #: canaille/forms.py:85
msgid "Family Name" msgid "Family Name"
msgstr "Nom de famille" msgstr "Nom de famille"
#: canaille/forms.py:74 #: canaille/forms.py:87
msgid "Doe" msgid "Doe"
msgstr "Dupont" msgstr "Dupont"
#: canaille/forms.py:80 #: canaille/forms.py:93
msgid "Email address" msgid "Email address"
msgstr "Courriel" msgstr "Courriel"
#: canaille/forms.py:89 canaille/templates/users.html:24 #: canaille/forms.py:102 canaille/templates/users.html:24
msgid "Phone number" msgid "Phone number"
msgstr "Numéro de téléphone" msgstr "Numéro de téléphone"
#: canaille/forms.py:89 #: canaille/forms.py:102
msgid "555-000-555" msgid "555-000-555"
msgstr "06 01 02 03 04" msgstr "06 01 02 03 04"
#: canaille/forms.py:91 #: canaille/forms.py:104
msgid "Photo" msgid "Photo"
msgstr "Photo" msgstr "Photo"
#: canaille/forms.py:105 #: canaille/forms.py:118
msgid "Number" msgid "Number"
msgstr "Numéro" msgstr "Numéro"
#: canaille/forms.py:107 #: canaille/forms.py:120
msgid "1234" msgid "1234"
msgstr "1234" msgstr "1234"
@ -440,7 +440,7 @@ msgid "Send the initialization email"
msgstr "Envoyer le courriel d'initialisation" msgstr "Envoyer le courriel d'initialisation"
#: canaille/templates/firstlogin.html:36 #: canaille/templates/firstlogin.html:36
#: canaille/templates/forgotten-password.html:37 #: canaille/templates/forgotten-password.html:43
msgid "Login page" msgid "Login page"
msgstr "Page de connexion" msgstr "Page de connexion"
@ -466,7 +466,11 @@ msgstr ""
" vous permettra de ré-initialiser votre mot de passe.\n" " vous permettra de ré-initialiser votre mot de passe.\n"
" " " "
#: canaille/templates/forgotten-password.html:36 #: canaille/templates/forgotten-password.html:38
msgid "Send again"
msgstr "Envoyer à nouveau"
#: canaille/templates/forgotten-password.html:40
#: canaille/templates/profile.html:92 #: canaille/templates/profile.html:92
msgid "Send" msgid "Send"
msgstr "Envoyer" msgstr "Envoyer"

View file

@ -1,14 +1,14 @@
# Translations template for PROJECT. # Translations template for PROJECT.
# Copyright (C) 2020 ORGANIZATION # Copyright (C) 2021 ORGANIZATION
# This file is distributed under the same license as the PROJECT project. # This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2020. # FIRST AUTHOR <EMAIL@ADDRESS>, 2021.
# #
#, fuzzy #, fuzzy
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PROJECT VERSION\n" "Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2020-12-31 19:41+0100\n" "POT-Creation-Date: 2021-01-01 15:28+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -104,81 +104,81 @@ msgstr ""
msgid "The access has been revoked" msgid "The access has been revoked"
msgstr "" msgstr ""
#: canaille/forms.py:12 canaille/forms.py:32 #: canaille/forms.py:12 canaille/forms.py:37
msgid "Login" msgid "Login"
msgstr "" msgstr ""
#: canaille/forms.py:15 canaille/forms.py:35 canaille/forms.py:83 #: canaille/forms.py:15 canaille/forms.py:40 canaille/forms.py:96
msgid "jane@doe.com" msgid "jane@doe.com"
msgstr "" msgstr ""
#: canaille/forms.py:22 canaille/forms.py:44 canaille/forms.py:93 #: canaille/forms.py:22 canaille/forms.py:57 canaille/forms.py:106
msgid "Password" msgid "Password"
msgstr "" msgstr ""
#: canaille/forms.py:28 #: canaille/forms.py:31 canaille/forms.py:51
msgid "The login '{login}' does not exist" msgid "The login '{login}' does not exist"
msgstr "" msgstr ""
#: canaille/forms.py:47 canaille/forms.py:97 #: canaille/forms.py:60 canaille/forms.py:110
msgid "Password confirmation" msgid "Password confirmation"
msgstr "" msgstr ""
#: canaille/forms.py:50 canaille/forms.py:100 #: canaille/forms.py:63 canaille/forms.py:113
msgid "Password and confirmation do not match." msgid "Password and confirmation do not match."
msgstr "" msgstr ""
#: canaille/forms.py:58 #: canaille/forms.py:71
msgid "Username" msgid "Username"
msgstr "" msgstr ""
#: canaille/forms.py:59 #: canaille/forms.py:72
msgid "jdoe" msgid "jdoe"
msgstr "" msgstr ""
#: canaille/admin/clients.py:23 canaille/forms.py:62 #: canaille/admin/clients.py:23 canaille/forms.py:75
#: canaille/templates/admin/client_list.html:25 #: canaille/templates/admin/client_list.html:25
#: canaille/templates/users.html:22 #: canaille/templates/users.html:22
msgid "Name" msgid "Name"
msgstr "" msgstr ""
#: canaille/forms.py:64 #: canaille/forms.py:77
msgid "Given name" msgid "Given name"
msgstr "" msgstr ""
#: canaille/forms.py:66 #: canaille/forms.py:79
msgid "John" msgid "John"
msgstr "" msgstr ""
#: canaille/forms.py:72 #: canaille/forms.py:85
msgid "Family Name" msgid "Family Name"
msgstr "" msgstr ""
#: canaille/forms.py:74 #: canaille/forms.py:87
msgid "Doe" msgid "Doe"
msgstr "" msgstr ""
#: canaille/forms.py:80 #: canaille/forms.py:93
msgid "Email address" msgid "Email address"
msgstr "" msgstr ""
#: canaille/forms.py:89 canaille/templates/users.html:24 #: canaille/forms.py:102 canaille/templates/users.html:24
msgid "Phone number" msgid "Phone number"
msgstr "" msgstr ""
#: canaille/forms.py:89 #: canaille/forms.py:102
msgid "555-000-555" msgid "555-000-555"
msgstr "" msgstr ""
#: canaille/forms.py:91 #: canaille/forms.py:104
msgid "Photo" msgid "Photo"
msgstr "" msgstr ""
#: canaille/forms.py:105 #: canaille/forms.py:118
msgid "Number" msgid "Number"
msgstr "" msgstr ""
#: canaille/forms.py:107 #: canaille/forms.py:120
msgid "1234" msgid "1234"
msgstr "" msgstr ""
@ -423,7 +423,7 @@ msgid "Send the initialization email"
msgstr "" msgstr ""
#: canaille/templates/firstlogin.html:36 #: canaille/templates/firstlogin.html:36
#: canaille/templates/forgotten-password.html:37 #: canaille/templates/forgotten-password.html:43
msgid "Login page" msgid "Login page"
msgstr "" msgstr ""
@ -443,7 +443,11 @@ msgid ""
" " " "
msgstr "" msgstr ""
#: canaille/templates/forgotten-password.html:36 #: canaille/templates/forgotten-password.html:38
msgid "Send again"
msgstr ""
#: canaille/templates/forgotten-password.html:40
#: canaille/templates/profile.html:92 #: canaille/templates/profile.html:92
msgid "Send" msgid "Send"
msgstr "" msgstr ""

View file

@ -8,6 +8,7 @@ def test_password_forgotten(SMTP, testclient, slapd_connection, user):
res.form["login"] = "user" res.form["login"] = "user"
res = res.form.submit(status=200) res = res.form.submit(status=200)
assert "A password reset link has been sent at your email address." in res.text assert "A password reset link has been sent at your email address." in res.text
assert "Send again" in res.text
SMTP.assert_called_once_with(host="localhost", port=25) SMTP.assert_called_once_with(host="localhost", port=25)