From 086b12ef7905ed9fcbfcad0845c55d01f8be30a7 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Wed, 27 Aug 2025 19:52:26 +0200 Subject: [PATCH] Activer reset du mot de passe --- common/settings.py | 2 + templates/registration/login.html | 6 +-- .../registration/password_reset_complete.html | 17 +++++++ .../registration/password_reset_confirm.html | 48 +++++++++++++++++++ .../registration/password_reset_done.html | 17 +++++++ .../registration/password_reset_form.html | 32 +++++++++++++ 6 files changed, 119 insertions(+), 3 deletions(-) create mode 100644 templates/registration/password_reset_complete.html create mode 100644 templates/registration/password_reset_confirm.html create mode 100644 templates/registration/password_reset_done.html create mode 100644 templates/registration/password_reset_form.html diff --git a/common/settings.py b/common/settings.py index 3876c66..02997a2 100644 --- a/common/settings.py +++ b/common/settings.py @@ -113,6 +113,8 @@ STATIC_ROOT = BASE_DIR / "static" LOGOUT_REDIRECT_URL = reverse_lazy("presentation") +DEFAULT_FROM_EMAIL = "webmaster@2xlibre.net" + # Default primary key field type # https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field diff --git a/templates/registration/login.html b/templates/registration/login.html index f77368a..dd89f8c 100644 --- a/templates/registration/login.html +++ b/templates/registration/login.html @@ -16,9 +16,9 @@ {{ form.password.errors }} {{ form.password }} - +
+ Mot de passe oublié ? +
diff --git a/templates/registration/password_reset_complete.html b/templates/registration/password_reset_complete.html new file mode 100644 index 0000000..517a330 --- /dev/null +++ b/templates/registration/password_reset_complete.html @@ -0,0 +1,17 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block breadcrumbs %} + +{% endblock %} + +{% block content %} + +

{% translate "Your password has been set. You may go ahead and log in now." %}

+ +

{% translate 'Log in' %}

+ +{% endblock %} diff --git a/templates/registration/password_reset_confirm.html b/templates/registration/password_reset_confirm.html new file mode 100644 index 0000000..7174edf --- /dev/null +++ b/templates/registration/password_reset_confirm.html @@ -0,0 +1,48 @@ +{% extends "base.html" %} +{% load i18n static %} + +{% block title %}{% if form.new_password1.errors or form.new_password2.errors %}{% translate "Error:" %} {% endif %}{{ block.super }}{% endblock %} +{% block extrastyle %}{{ block.super }}{% endblock %} +{% block breadcrumbs %} + +{% endblock %} + +{% block content %} + +{% if validlink %} + +

{% translate "Please enter your new password twice so we can verify you typed it in correctly." %}

+ +
{% csrf_token %} +
+ +
+ {{ form.new_password1.errors }} +
+ + {{ form.new_password1 }} +
+
+
+ {{ form.new_password2.errors }} +
+ + {{ form.new_password2 }} +
+
+
+
+ +
+
+ +{% else %} + +

{% translate "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}

+ +{% endif %} + +{% endblock %} diff --git a/templates/registration/password_reset_done.html b/templates/registration/password_reset_done.html new file mode 100644 index 0000000..6a083ce --- /dev/null +++ b/templates/registration/password_reset_done.html @@ -0,0 +1,17 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block breadcrumbs %} + +{% endblock %} + +{% block content %} + +

{% translate 'We’ve emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly.' %}

+ +

{% translate 'If you don’t receive an email, please make sure you’ve entered the address you registered with, and check your spam folder.' %}

+ +{% endblock %} diff --git a/templates/registration/password_reset_form.html b/templates/registration/password_reset_form.html new file mode 100644 index 0000000..0569511 --- /dev/null +++ b/templates/registration/password_reset_form.html @@ -0,0 +1,32 @@ +{% extends "base.html" %} +{% load i18n static %} + +{% block title %}{% if form.email.errors %}{% translate "Error:" %} {% endif %}{{ block.super }}{% endblock %} +{% block extrastyle %}{{ block.super }}{% endblock %} +{% block breadcrumbs %} + +{% endblock %} + +{% block content %} + +

{% translate 'Forgotten your password? Enter your email address below, and we’ll email instructions for setting a new one.' %}

+ +
{% csrf_token %} +
+
+ {{ form.email.errors }} +
+ + {{ form.email }} +
+
+
+
+ +
+
+ +{% endblock %}