Let users delete their accounts

This commit is contained in:
Mouse Reeve
2021-06-14 10:44:25 -07:00
parent 7ae64c2a68
commit 8cd6712db3
7 changed files with 71 additions and 30 deletions

View File

@ -1,27 +0,0 @@
{% extends 'preferences/layout.html' %}
{% load i18n %}
{% block title %}{% trans "Delete Account" %}{% endblock %}
{% block header %}
{% trans "Delete Account" %}
{% endblock %}
{% block panel %}
{% if form.non_field_errors %}
<p class="notification is-danger">{{ form.non_field_errors }}</p>
{% endif %}
<div class="block">
<h2 class="title is-4">{% trans "Permanently delete account" %}</h2>
<p class="help">{% trans "Deleting your account cannot be undone. The username will not be available to register in the future." %}</p>
<form name="delete-account" action="/delete-account" method="post">
<div class="field">
<label class="label" for="id_password">{% trans "Confirm password" %}</label>
<input class="input" type="password" name="password" id="id_password">
</div>
<button type="submit" class="is-danger">Delete</button>
</form>
</div>
{% endblock %}

View File

@ -0,0 +1,30 @@
{% extends 'preferences/layout.html' %}
{% load i18n %}
{% block title %}{% trans "Delete Account" %}{% endblock %}
{% block header %}
{% trans "Delete Account" %}
{% endblock %}
{% block panel %}
<div class="block">
<h2 class="title is-4">{% trans "Permanently delete account" %}</h2>
<p class="notification is-danger is-light">
{% trans "Deleting your account cannot be undone. The username will not be available to register in the future." %}
</p>
<form name="delete-user" action="{% url 'prefs-delete' %}" method="post">
{% csrf_token %}
<div class="field">
<label class="label" for="id_password">{% trans "Confirm password:" %}</label>
<input class="input {% if form.password.errors %}is-danger{% endif %}" type="password" name="password" id="id_password" required>
{% for error in form.password.errors %}
<p class="help is-danger">{{ error | escape }}</p>
{% endfor %}
</div>
<button type="submit" class="button is-danger">{% trans "Delete Account" %}</button>
</form>
</div>
{% endblock %}

View File

@ -69,3 +69,4 @@
</div>
<div class="block"><button class="button is-primary" type="submit">{% trans "Save" %}</button></div>
</form>
{% endblock %}