Skip to content

Commit

Permalink
update the set-password page
Browse files Browse the repository at this point in the history
  • Loading branch information
tudoramariei committed Dec 20, 2024
1 parent e777b94 commit c842a8a
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 57 deletions.
4 changes: 2 additions & 2 deletions backend/donations/views/account_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def get(self, request, *args, **kwargs):


class SetPasswordView(BaseVisibleTemplateView):
template_name = "parola-noua.html"
template_name = "account/set-password.html"
title = _("Set New Password")

def post(self, request, *args, **kwargs):
Expand Down Expand Up @@ -279,7 +279,7 @@ class VerificationView(BaseVisibleTemplateView):
p - reset user password
"""

template_name = "parola-noua.html"
template_name = "account/set-password.html"
title = _("Verification")

def get(self, request, *args, **kwargs):
Expand Down
55 changes: 0 additions & 55 deletions backend/templates/v1/parola-noua.html

This file was deleted.

23 changes: 23 additions & 0 deletions backend/templates/v2/account/components/password-input.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{% load i18n %}

{% if not field_label %}
{% trans "Password" as field_label %}
{% endif %}

<div>
<label>
<span class="block text-sm/6 font-medium text-gray-900 mb-2">
{{ field_label }}
</span>
<input
type="password"
name="{{ input_name }}"
{% if password_type == "new" %}
autocomplete="new-password"
{% else %}
autocomplete="current-password"
{% endif %}
class="block w-full rounded-md bg-white px-3 py-1.5 text-base text-gray-900 outline outline-1 -outline-offset-1 outline-gray-300 placeholder:text-gray-400 focus:outline focus:outline-2 focus:-outline-offset-2 focus:outline-amber-400 sm:text-sm/6"
required>
</label>
</div>
51 changes: 51 additions & 0 deletions backend/templates/v2/account/set-password.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{% extends "account/base.html" %}
{% load i18n static %}

{% block head_title %}
{{ title }}
{% endblock head_title %}

{% block additional_headers %}
<script src='https://www.google.com/recaptcha/api.js?hl=ro' async defer></script>
{% endblock %}

{% block content %}

<div class="container max-w-6xl">

<form id='reset-password' action="/password/" role="form" method="post">
<header class="flex flex-col justify-center items-center">
<h1 class="text-center text-gray-900 text-3xl font-bold leading-9 mb-6">
{% trans "Set a new password" %}
</h1>
</header>

{% csrf_token %}

<div class="overflow-hidden rounded-lg bg-white drop-shadow ring-1 ring-gray-200">
<div class="px-10 py-8 grid gap-6">

<input type="hidden" name="token" value="{{ token }}"/>

{% trans "New password" as password_label %}
{% trans "Confirm password" as password_confirm_label %}

{% include "account/components/password-input.html" with field_label=password_label input_name="password" password_type="new" %}

{% include "account/components/password-input.html" with field_label=password_confirm_label input_name="password_confirm" password_type="new" %}

<button
type="submit"
class="w-full text-center bg-amber-300 sm:text-base text-sm sm:px-6 sm:py-2 px-2 py-1 shadow-sm rounded-full text-gray-900 hover:bg-amber-200 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-amber-300">
{% trans "Change password" %}
</button>

</div>
</div>
</form>

<div class="g-recaptcha" data-sitekey="{{ captcha_public_key }}" data-size="invisible" data-callback="onSubmit"></div>

</div>

{% endblock %}

0 comments on commit c842a8a

Please sign in to comment.