Files
ping-mee-self-service-platform/portal/templates/profile/email.html
T
Ebbe BaßandClaude Sonnet 5.5 94c1d39c9d feat: add e-mail change with confirmation and undo
Page at /email asks for the new address and the current password (shared failure counter with the password page, five requests per hour) and mails a one-hour confirmation link to the new address. Confirming writes the address and mails the old address a 24-hour undo link; undoing restores it, ends every session of the user and notifies the Admin (ADMIN_NOTIFY_EMAIL). Link pages show on GET and apply on POST; tokens are stored only as hashes, single use, and are blanked from every log line. New table owned by profile, German text, tests; review findings logged in the plan.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FocPJ75XPma7TcuYEMy8zm
2026-10-19 10:05:41 +02:00

42 lines
1.9 KiB
HTML

{% extends "base.html" %}
{% load i18n %}
{% block title %}{% trans "Change e-mail address" %}{% endblock %}
{% block content %}
<h1>{% trans "Change e-mail address" %}</h1>
<p class="lead">{% trans "Announcements and security notices are sent to this address. We send a link to the new address. Your address changes only after you open the link and confirm." %}</p>
{% if throttled %}
<div class="notice" role="alert" tabindex="-1" data-focus-on-load>
<p>{% trans "Too many attempts. Please wait a few minutes." %}</p>
</div>
<p><a class="button" href="{% url 'home' %}">{% trans "Back to the start page" %}</a></p>
{% else %}
{% if form.errors %}
<div class="error-summary" role="alert" tabindex="-1" data-focus-on-load>
<p><strong>{% trans "No link was sent." %}</strong></p>
<ul>
{% for field in form %}{% for error in field.errors %}
<li><a href="#{{ field.id_for_label }}">{{ error }}</a></li>
{% endfor %}{% endfor %}
</ul>
</div>
{% endif %}
{% if current is not None %}
<dl class="card details">
<dt>{% trans "Current e-mail address" %}</dt>
<dd>{% if current %}{{ current }}{% else %}&ndash;{% endif %}</dd>
</dl>
{% endif %}
<form method="post" action="{% url 'email' %}" class="card" data-busy-on-submit novalidate>
{% csrf_token %}
{% trans "New e-mail address" as label %}
{% include "profile/_text_field.html" with field=form.new_email label=label max_length=254 autocomplete="email" input_type="email" required=True %}
{% trans "Current password" as label %}{% trans "We check it before anything is sent." as hint %}
{% include "profile/_field.html" with field=form.current_password label=label hint=hint autocomplete="current-password" %}
<p class="actions">
<button type="submit" class="primary"><span class="spinner" aria-hidden="true"></span>{% trans "Send confirmation link" %}</button>
<a class="button" href="{% url 'profile' %}">{% trans "Cancel" %}</a>
</p>
</form>
{% endif %}
{% endblock %}