Verified Commit 240133f8 authored by Jelle van der Waa's avatar Jelle van der Waa 🚧
Browse files

WIP: implement account deletion

parent edef6cc6
Pipeline #21939 passed with stages
in 2 minutes and 43 seconds
......@@ -484,6 +484,28 @@ async def account_comments(request: Request, username: str):
return render_template(request, "account/comments.html", context)
@router.get("/account/{username}/delete")
@requires_auth
async def account_delete(request: Request, username: str):
user = get_user_by_name(username)
context = make_context(request, "Accounts")
context["user"] = user
return render_template(request, "account/delete.html", context)
@router.post("/account/{username}/delete")
@handle_form_exceptions
@requires_auth
async def post_account_delete(request: Request, username: str, passwd: str, confirm: int):
user = get_user_by_name(username)
print(user)
print(passwd)
print(confirm)
context = make_context(request, "Accounts")
context["user"] = user
return render_template(request, "account/delete.html", context)
@router.get("/accounts")
@requires_auth
@account_type_required({at.TRUSTED_USER,
......
{% extends "partials/layout.html" %}
{% block pageContent %}
<div class="box">
<h2>{{ "Accounts" | tr }}</h2>
<p>
{{ "You can use this form to permanently delete the AUR account %s."
| tr
| format('<strong>%s</strong>' | format(user.Username))
| safe
}}
</p>
<p>
{{ "%sWARNING%s: This action cannot be undone."
| tr
| format("<strong>", "</strong>")
| safe
}}
</p>
<form id="edit-profile-form" method="post" action="{{ '%s/delete' | format(user | account_url) }}">
<fieldset>
<input type="hidden" name="username" value="{{ user.Username }}" />
</fieldset>
<fieldset>
<p>
<label for="id_passwd">
{{ "Password" | tr }}:
</label>
<input type="password" size="30" name="passwd" id="id_passwd" value="" />
</p>
<p>
<label class="confirmation"><input type="checkbox" name="confirm" value="1" />
{{ "Confirm deletion" | tr }}
</label>
</p>
<p>
<input type="submit" class="button" value="{{ "Delete" | tr }}" />
</p>
</fieldset>
</form>
</div>
{% endblock %}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment