Add profile page for changing password and email

New /profile route (nav link between Admin and Logout) with two
independent forms, both requiring the current password before
applying a change:
- Change password: standard current/new/repeat flow, same password
  strength rules as registration.
- Change email: re-checks the new address isn't already taken (avoids
  a 500 from the unique constraint), then marks the account
  unverified and re-sends the confirmation email via the existing
  EmailVerifier/verify-email flow, same as registration. The current
  session stays logged in, but the user needs to verify the new
  address before their next login (UserChecker already blocks
  unverified accounts).
This commit is contained in:
Frank
2026-07-11 23:23:38 +02:00
parent 2941cfca49
commit 886208c5c0
7 changed files with 244 additions and 0 deletions
+3
View File
@@ -26,6 +26,9 @@
<a class="nav-link" href="{{ path('game_admin_dashboard') }}">{{ 'nav.admin'|trans }}</a>
</li>
{% endif %}
<li class="nav-item">
<a class="nav-link" href="{{ path('app_profile') }}">{{ 'nav.profile'|trans }}</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ path('app_logout') }}">{{ 'nav.logout'|trans }}</a>
</li>
+39
View File
@@ -0,0 +1,39 @@
{% extends 'layout/site.html.twig' %}
{% block title %}Profile{% endblock %}
{% block body %}
<h1 class="mb-4">Profile</h1>
<div class="row g-4">
<div class="col-md-6">
<div class="card h-100">
<div class="card-header bg-secondary text-white">Change Email</div>
<div class="card-body">
<p class="text-muted">Current email: {{ user.email }}</p>
{{ form_start(emailForm) }}
{{ form_row(emailForm.email) }}
{{ form_row(emailForm.currentPassword) }}
<div class="d-grid mt-3">
<button type="submit" class="btn btn-primary">Update Email</button>
</div>
{{ form_end(emailForm) }}
</div>
</div>
</div>
<div class="col-md-6">
<div class="card h-100">
<div class="card-header bg-secondary text-white">Change Password</div>
<div class="card-body">
{{ form_start(passwordForm) }}
{{ form_row(passwordForm.currentPassword) }}
{{ form_row(passwordForm.plainPassword) }}
<div class="d-grid mt-3">
<button type="submit" class="btn btn-primary">Update Password</button>
</div>
{{ form_end(passwordForm) }}
</div>
</div>
</div>
</div>
{% endblock %}