mirror of
https://github.com/MarijnDoeve/TijdVoorDeTest.git
synced 2026-07-08 16:40:15 +02:00
1d3e99d2b2
* feat: user settings page (#182) - Settings link in the backoffice nav next to Logout - Language selector (Dutch only, noop save) - Change password form with current-password check - Change email form that re-triggers email confirmation - Resend confirmation email button for unconfirmed addresses - Disabled Download data button with Soon(tm) popover - Delete account with password confirmation modal, removes seasons the user is the sole owner of - Well-known URLs: change-password redirect and security.txt * feat: base security.txt Expires on the container build time The BUILD_TIME build arg is baked into the prod image as an env var and set by CI at image build. security.txt expires one year after the build, so the file goes stale when deployments stop. Dev and test fall back to one year from the request time. * refactor: extract shared controller functionality - AbstractController: authenticatedUser property hook and assertSameSeason() (moved from QuestionBankController) - EmailVerifier::sendDefaultConfirmation() replaces the duplicated confirmation email block in RegistrationController and SettingsController - QuizController: deduplicate candidate-data preparation into buildCandidateData() - Drop manual 422 status handling in QuizQuestionController, QuestionBankController and SettingsController: render() already returns 422 for submitted invalid forms passed as parameters * fix: address PR review comments - Catch UniqueConstraintViolationException when changing email to handle the race between the uniqueness check and the flush - Avoid else-only block in UserRepository::deleteUser - Align duplicate-email translation with the validators domain * fix: apply code-review findings for PR #191 - Invalidate outstanding ResetPasswordRequests after password or email change to close the account-takeover window (tokens otherwise remain valid) - Exclude the current user from email uniqueness check so submitting your own address no longer returns an error - Surface transport failures from sendDefaultConfirmation via a warning flash instead of silently showing success - Move Dockerfile ARG BUILD_TIME/ENV to after all build steps so changing the build timestamp no longer busts the composer/asset cache - Throw in prod when BUILD_TIME is missing (WellKnownController) so the security.txt Expires goes stale as intended when deployments stop; fall back to 'now' only in dev/test
104 lines
5.4 KiB
Twig
104 lines
5.4 KiB
Twig
{% extends 'backoffice/base.html.twig' %}
|
|
|
|
{% block title %}{{ parent() }}{{ 'Settings'|trans }}{% endblock %}
|
|
|
|
{% block breadcrumbs %}
|
|
<nav aria-label="breadcrumb" class="mb-3">
|
|
<ol class="breadcrumb">
|
|
<li class="breadcrumb-item"><a href="{{ path('tvdt_backoffice_index') }}">{{ 'Home'|trans }}</a></li>
|
|
<li class="breadcrumb-item active" aria-current="page">{{ 'Settings'|trans }}</li>
|
|
</ol>
|
|
</nav>
|
|
{% endblock %}
|
|
|
|
{% block body %}
|
|
<div class="row">
|
|
<div class="col-lg-6 col-12">
|
|
<h2 class="mb-4">{{ 'Settings'|trans }}</h2>
|
|
|
|
<section class="mb-5">
|
|
<h4>{{ 'Language'|trans }}</h4>
|
|
<form action="{{ path('tvdt_backoffice_settings_language') }}" method="POST">
|
|
<input type="hidden" name="_token" value="{{ csrf_token('settings_language') }}">
|
|
<div class="mb-3">
|
|
<label class="form-label" for="settings-language">{{ 'Language'|trans }}</label>
|
|
<select class="form-select" id="settings-language" name="language">
|
|
<option value="nl" selected>Nederlands</option>
|
|
</select>
|
|
</div>
|
|
<button type="submit" class="btn btn-primary">{{ 'Save'|trans }}</button>
|
|
</form>
|
|
</section>
|
|
|
|
<section class="mb-5">
|
|
<h4>{{ 'Change password'|trans }}</h4>
|
|
{{ form(passwordForm, {action: path('tvdt_backoffice_settings_password')}) }}
|
|
</section>
|
|
|
|
<section class="mb-5">
|
|
<h4>{{ 'Change email'|trans }}</h4>
|
|
<p class="mb-1">
|
|
<strong>{{ 'Current email address:'|trans }}</strong> {{ app.user.userIdentifier }}
|
|
{% if app.user.isVerified %}
|
|
<span class="badge text-bg-success">{{ 'Confirmed'|trans }}</span>
|
|
{% else %}
|
|
<span class="badge text-bg-warning">{{ 'Not confirmed'|trans }}</span>
|
|
<form class="d-inline" action="{{ path('tvdt_backoffice_settings_resend_confirmation') }}" method="POST">
|
|
<input type="hidden" name="_token" value="{{ csrf_token('resend_confirmation') }}">
|
|
<button type="submit" class="btn btn-link btn-sm p-0 align-baseline">
|
|
{{ 'Resend confirmation email'|trans }}
|
|
</button>
|
|
</form>
|
|
{% endif %}
|
|
</p>
|
|
<p>{{ 'After changing your email address you will receive a new confirmation email.'|trans }}</p>
|
|
{{ form(emailForm, {action: path('tvdt_backoffice_settings_email')}) }}
|
|
</section>
|
|
|
|
<section class="mb-5" data-controller="bo--popover">
|
|
<h4>{{ 'Your data'|trans }}</h4>
|
|
<span class="d-inline-block" tabindex="0"
|
|
data-bs-toggle="popover"
|
|
data-bs-trigger="hover focus"
|
|
data-bs-content="{{ 'Soon™'|trans }}">
|
|
<button type="button" class="btn btn-secondary pe-none" disabled>{{ 'Download data'|trans }}</button>
|
|
</span>
|
|
</section>
|
|
|
|
<section class="mb-5">
|
|
<h4 class="text-danger">{{ 'Danger zone'|trans }}</h4>
|
|
<p>{{ 'Deleting your account also deletes every season you are the only owner of. This cannot be undone.'|trans }}</p>
|
|
<button type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#deleteAccountModal">
|
|
{{ 'Delete account...'|trans }}
|
|
</button>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="modal fade" id="deleteAccountModal" data-bs-backdrop="static"
|
|
tabindex="-1"
|
|
aria-labelledby="deleteAccountModalLabel" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<form action="{{ path('tvdt_backoffice_settings_delete') }}" method="POST">
|
|
<div class="modal-header">
|
|
<h1 class="modal-title fs-5" id="deleteAccountModalLabel">{{ 'Delete account'|trans }}</h1>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<p>{{ 'This deletes your account and every season you are the only owner of. Enter your password to confirm.'|trans }}</p>
|
|
<input type="hidden" name="_token" value="{{ csrf_token('delete_account') }}">
|
|
<label class="form-label" for="delete-account-password">{{ 'Current password'|trans }}</label>
|
|
<input type="password" class="form-control" id="delete-account-password"
|
|
name="password" required autocomplete="current-password">
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{{ 'Cancel'|trans }}</button>
|
|
<button type="submit" class="btn btn-danger">{{ 'Delete account'|trans }}</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|