feat: password reset workflow
ci/woodpecker/push/woodpecker Pipeline was successful
Details
ci/woodpecker/push/woodpecker Pipeline was successful
Details
fixes: https://gitea.hostea.org/Hostea/support/issues/2wip-forget-password
parent
060e9b84d4
commit
6c31555a52
@ -0,0 +1,52 @@
|
||||
# Generated by Django 4.0.3 on 2022-07-10 06:14
|
||||
|
||||
import accounts.utils
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
("accounts", "0005_accountconfirmchallenge_created_at"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="PasswordResetChallenge",
|
||||
fields=[
|
||||
(
|
||||
"public_ref",
|
||||
models.CharField(
|
||||
default=accounts.utils.gen_secret,
|
||||
editable=False,
|
||||
max_length=32,
|
||||
unique=True,
|
||||
verbose_name="Public referece to challenge text",
|
||||
),
|
||||
),
|
||||
("created_at", models.DateTimeField(auto_now_add=True)),
|
||||
(
|
||||
"challenge_text",
|
||||
models.CharField(
|
||||
default=accounts.utils.gen_secret,
|
||||
editable=False,
|
||||
max_length=32,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
unique=True,
|
||||
verbose_name="Challenge text",
|
||||
),
|
||||
),
|
||||
(
|
||||
"owned_by",
|
||||
models.OneToOneField(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
to=settings.AUTH_USER_MODEL,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
]
|
@ -0,0 +1,28 @@
|
||||
{% extends "common/components/base.html" %}
|
||||
{% block title %} Reset Password| Hostea Dashboard{% endblock %}
|
||||
{% block nav %} {% include "common/components/nav/pub.html" %} {% endblock %}
|
||||
{% block main %}
|
||||
<div class="dialogue-box__container">
|
||||
<h2>Reset password</h2>
|
||||
<form
|
||||
action="{% url 'accounts.password.reset.new' %}"
|
||||
method="POST"
|
||||
class="form"
|
||||
accept-charset="utf-8"
|
||||
>
|
||||
{% include "common/components/error.html" %} {% csrf_token %}
|
||||
<label class="form__label" for="email">
|
||||
Email
|
||||
<input
|
||||
class="form__input"
|
||||
name="email"
|
||||
id="email"
|
||||
type="email"
|
||||
/>
|
||||
</label>
|
||||
<div class="form__action-container">
|
||||
<button class="form__submit" type="submit">Send Password Reset Link</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
@ -0,0 +1,20 @@
|
||||
{% extends "common/components/base.html" %}
|
||||
{% block title %} Reset Password | Hostea Dashboard{% endblock %}
|
||||
{% block nav %} {% include "common/components/nav/pub.html" %} {% endblock %}
|
||||
{% block main %}
|
||||
<div class="dialogue-box__container">
|
||||
<h2>Reset password</h2>
|
||||
<p>Verification link is sent to email address: {{email}}</p>
|
||||
<form
|
||||
action="{% url 'accounts.password.reset.resend' public_ref=public_ref %}"
|
||||
method="POST"
|
||||
class="form"
|
||||
accept-charset="utf-8"
|
||||
>
|
||||
{% include "common/components/error.html" %} {% csrf_token %}
|
||||
<div class="form__action-container">
|
||||
<button class="form__submit" type="submit">Click here to resend email</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
@ -0,0 +1,40 @@
|
||||
{% extends "common/components/base.html" %}
|
||||
{% block title %} Reset Password | Hostea Dashboard{% endblock %}
|
||||
{% block nav %} {% include "common/components/nav/pub.html" %} {% endblock %}
|
||||
{% block main %}
|
||||
<div class="dialogue-box__container">
|
||||
<h2>Reset Password</h2>
|
||||
<form
|
||||
action="{% url 'accounts.password.reset' challenge=challenge %}"
|
||||
method="POST"
|
||||
class="form"
|
||||
accept-charset="utf-8"
|
||||
>
|
||||
{% include "common/components/error.html" %} {% csrf_token %}
|
||||
<label class="form__label" for="password">
|
||||
password
|
||||
<input
|
||||
class="form__input"
|
||||
name="password"
|
||||
required
|
||||
id="password"
|
||||
type="password"
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label class="form__label" for="confirm_password">
|
||||
Re-enter Password
|
||||
<input
|
||||
class="form__input"
|
||||
name="confirm_password"
|
||||
required
|
||||
id="confirm_password"
|
||||
type="password"
|
||||
/>
|
||||
</label>
|
||||
<div class="form__action-container">
|
||||
<button class="form__submit" type="submit">Reset Password</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
@ -0,0 +1,14 @@
|
||||
Hello {{ username }},
|
||||
|
||||
You have a new password!
|
||||
|
||||
Your password for signing in to Hostea was recently changed. If you made this change, then we're all set.
|
||||
|
||||
If you did not make this change, please reset your password to secure your account.
|
||||
|
||||
{% url 'accounts.password.reset.new' %}
|
||||
|
||||
Either way, feel free to reach out with any questions you might have. We're here to help.
|
||||
|
||||
Cheers,
|
||||
Hostea team
|
@ -0,0 +1,9 @@
|
||||
Hello {{ email }},
|
||||
|
||||
Please click on the link below to reset your password:
|
||||
{{ link }}
|
||||
|
||||
If you don't recognise this activity, please delete this mail.
|
||||
|
||||
Cheers,
|
||||
Hostea team
|
@ -0,0 +1,14 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Forgot Your Password?{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Forgot your password?</h1>
|
||||
<p>Enter your email address below, and we'll email instructions for setting a new one.</p>
|
||||
|
||||
<form method="POST">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<input type="submit" value="Send me instructions!">
|
||||
</form>
|
||||
{% endblock %}
|
Loading…
Reference in New Issue