From patchwork Wed Sep 1 16:57:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 1523328 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" header.d=that.guru header.i=@that.guru header.a=rsa-sha256 header.s=x header.b=cqcgcC9B; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4H09J33b6tz9sX3 for ; Thu, 2 Sep 2021 02:58:59 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4H09J32Wp2z2yNS for ; Thu, 2 Sep 2021 02:58:59 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" header.d=that.guru header.i=@that.guru header.a=rsa-sha256 header.s=x header.b=cqcgcC9B; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=that.guru (client-ip=136.175.108.248; helo=mail-108-mta248.mxroute.com; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" header.d=that.guru header.i=@that.guru header.a=rsa-sha256 header.s=x header.b=cqcgcC9B; dkim-atps=neutral Received: from mail-108-mta248.mxroute.com (mail-108-mta248.mxroute.com [136.175.108.248]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4H09Hm4SQRz2yQ4 for ; Thu, 2 Sep 2021 02:58:43 +1000 (AEST) Received: from filter004.mxroute.com ([149.28.56.236] filter004.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta248.mxroute.com (ZoneMTA) with ESMTPSA id 17ba24c56e200074ba.001 for (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256); Wed, 01 Sep 2021 16:58:37 +0000 X-Zone-Loop: 8736991f56dfb420745ca87d53a4acf7da721127db5b X-Originating-IP: [149.28.56.236] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=x; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=YG9uSVnoxJQlmogx0go8sCKSpQKQW0MBc21uXmoSCYw=; b=cqcgcC9BhgtM7xkLpviEgYrnjw fmZnzwc3vq2k3zLwhB+grC8fW3OKlEoAhmDvjf+qqddfnWeFzgPpA1KY7VUnVXPE3/5or6CoC7LXu 57jLHmuO+PenstdGu6yrHTB1WagLPWN/6p2qUNaCWCl6weOu7pHIUvMRZYIII3stay49rc6A3234p jml2Kyzt7e+a9r4xso+4SBCXX+Y7q2GxmQ70t9lmG983Kb34Db4C+GQhlQPosdG6uoZev2pj2PwGe ZnNK7X39ch3lZy1zuffKWM//Ww9nu7k7CKN8bvidonmxucrLqpnfnC7Z6KI5Ba+iSrDQUiMdJ2UTd DpJ4mDIQ==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [RFC PATCH v2 09/19] templates: Convert login, password reset views Date: Wed, 1 Sep 2021 17:57:46 +0100 Message-Id: <20210901165756.181192-10-stephen@that.guru> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210901165756.181192-1-stephen@that.guru> References: <20210901165756.181192-1-stephen@that.guru> MIME-Version: 1.0 X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" The only things off note here are that we're removing the 'password_reset_complete.html' template in favour of redirecting to the login page, and that we're opting to generate the forms ourselves rather than relying on forms generated by Django which are too difficult to style. This might actually help us in the future if/when we move to a AJAX-driven UI. Signed-off-by: Stephen Finucane --- patchwork/templates/patchwork/login.html | 96 +++++++++++----- patchwork/urls.py | 4 +- templates/base2.html | 15 +++ .../registration/password_reset_complete.html | 8 -- .../registration/password_reset_confirm.html | 104 +++++++++++------- .../registration/password_reset_done.html | 35 ++++-- .../registration/password_reset_form.html | 75 +++++++------ 7 files changed, 218 insertions(+), 119 deletions(-) create mode 100644 templates/base2.html delete mode 100644 templates/registration/password_reset_complete.html diff --git patchwork/templates/patchwork/login.html patchwork/templates/patchwork/login.html index 86111342..ef609f1f 100644 --- patchwork/templates/patchwork/login.html +++ patchwork/templates/patchwork/login.html @@ -1,37 +1,77 @@ -{% extends "base.html" %} +{% extends "base2.html" %} {% block title %}Sign in to Patchwork{% endblock %} -{% block heading %}Sign in to Patchwork{% endblock %} {% block headers %} - {% endblock %} {% block body %} -
-{% csrf_token %} - - - - -{% if error %} - - - +
+
+
+
+
+
+

Sign in to Patchwork

+
+{% if form.non_field_errors %} +
+ + {{ form.non_field_errors }} +
{% endif %} -{{ form }} -
- - - -
login
{{ error }}
- - - Forgot password? -
-
+
+ {% csrf_token %} +
+ +
+ + + + +
+{% for error in form.username.errors %} +

{{ error }}

+{% endfor %} +
+
+ +
+ + + + +
+{% for error in form.password.errors %} +

{{ error }}

+{% endfor %} +
+
+ +
+
+
+ Sign Up +  •  + Forgot Password +
+ + + + + + + {% endblock %} diff --git patchwork/urls.py patchwork/urls.py index 5ddf2dbd..a7dfc3d3 100644 --- patchwork/urls.py +++ patchwork/urls.py @@ -153,7 +153,9 @@ urlpatterns = [ ), path( 'user/password-reset///', - auth_views.PasswordResetConfirmView.as_view(), + auth_views.PasswordResetConfirmView.as_view( + success_url=reverse_lazy('auth_login'), + ), name='password_reset_confirm', ), path( diff --git templates/base2.html templates/base2.html new file mode 100644 index 00000000..ac6b43bc --- /dev/null +++ templates/base2.html @@ -0,0 +1,15 @@ +{% load static %} + + + + + + {% block title %}Patchwork{% endblock %} - Patchwork + + +{% block headers %}{% endblock %} + + +{% block body %}{% endblock %} + + diff --git templates/registration/password_reset_complete.html templates/registration/password_reset_complete.html deleted file mode 100644 index 8678ee89..00000000 --- templates/registration/password_reset_complete.html +++ /dev/null @@ -1,8 +0,0 @@ -{% extends "base.html" %} - -{% block title %}Password reset completed{% endblock %} -{% block heading %}Password reset completed{% endblock %} - -{% block body %} -

Your password has been set. You may go ahead and log in now.

-{% endblock %} diff --git templates/registration/password_reset_confirm.html templates/registration/password_reset_confirm.html index 4ab2357f..1c91eb1b 100644 --- templates/registration/password_reset_confirm.html +++ templates/registration/password_reset_confirm.html @@ -1,49 +1,77 @@ -{% extends "base.html" %} +{% extends "base2.html" %} {% block title %}Password reset confirmation{% endblock %} {% block heading %}Password reset confirmation{% endblock %} {% block body %} +
+
+
+
+
{% if validlink %} -

- Your username, in case you've forgotten: {{ form.user.get_username }} -

-

- Please enter your new password twice so we can verify you typed it in - correctly. -

- -
- {% csrf_token %} - -{% if form.errors %} - - -{% endif %} -{% for field in form %} - - - - + + {% csrf_token %} +
+ +
+ + + + +
+{% for error in form.new_password1.errors %} +

{{ error }}

+{% endfor %} +
+
+ +
+ + + + +
+{% for error in form.new_password2.errors %} +

{{ error }}

{% endfor %} -
- - -
Please correct the errors below.

-
{{ field.label_tag }} - {{ field.errors }} - {{ field }} -{% if field.help_text %} -
{{ field.help_text }}
+
+

Change password for @{{ form.user.get_username }}

+
+{% if form.non_field_errors %} +
+ + {{ form.non_field_errors }} +
{% endif %} -
- -
-
+
+
+ +
+ {% else %} -

- The password reset link was invalid, possibly because it has already - been used. Please request a new password reset. -

+
+

Reset your password

+
+
+

+ The password reset link was invalid, possibly because it has already been used. + Try again. +

+ + Reset password + +
{% endif %} +
+
+
+ +
{% endblock %} diff --git templates/registration/password_reset_done.html templates/registration/password_reset_done.html index 6070f767..ebd38e68 100644 --- templates/registration/password_reset_done.html +++ templates/registration/password_reset_done.html @@ -1,15 +1,28 @@ -{% extends "base.html" %} +{% extends "base2.html" %} -{% block title %}Password reset{% endblock %} -{% block heading %}Password reset{% endblock %} +{% block title %}Password reset email sent!{% endblock %} {% block body %} -

- We have emailed you instructions for setting your password. - You should be receiving them shortly. -

-

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

+
+
+
+
+
+
+

Reset your password

+
+
+

+ We have emailed you a link to reset your password. + If you don't receive this email shortly, check your spam folder. +

+ + Return to sign in + +
+
+
+
+
+
{% endblock %} diff --git templates/registration/password_reset_form.html templates/registration/password_reset_form.html index fa6f3f1a..431b4696 100644 --- templates/registration/password_reset_form.html +++ templates/registration/password_reset_form.html @@ -1,39 +1,48 @@ -{% extends "base.html" %} +{% extends "base2.html" %} -{% block title %}Password reset{% endblock %} -{% block heading %}Password reset{% endblock %} +{% block title %}Forgot your password?{% endblock %} {% block body %} -

- Forgotten your password? Enter your email address below, and we will - email instructions for setting a new one. -

- -
- {% csrf_token %} - -{% if form.errors %} - - -{% endif %} -{% for field in form %} - - - - + + {% csrf_token %} +
+ +
+ + + + +
+{% for error in form.email.errors %} +

{{ error }}

{% endfor %} -
- - -
Please correct the errors below.

-
{{ field.label_tag }} - {{ field.errors }} - {{ field }} -{% if field.help_text %} -
{{ field.help_text }}
+
+
+
+
+
+
+

Reset your password

+
+{% if form.non_field_errors %} +
+ + {{ form.non_field_errors }} +
{% endif %} -
- -
-
+ +
+ +
+ + + + + + {% endblock %}