Private
Public Access
1
0

chg: usr: add forgot password functionality #4

This commit is contained in:
2026-04-12 08:10:36 +02:00
parent c0dcc2896a
commit e2b227ed7a
8 changed files with 512 additions and 69 deletions

View File

@@ -0,0 +1,60 @@
{% extends 'Game/index.html.twig' %}
{% block title %} - Forgot Password{% endblock %}
{% block body %}
<div class="auth-page">
{% for email in app.flashes('reset_sent') %}
<div class="auth-card auth-card--sent">
<div class="auth-sent-icon"><i class="fa fa-envelope-o"></i></div>
<h2 class="auth-title">Check your inbox</h2>
<p class="auth-sub">If an account exists for that address, we sent a reset link to</p>
<p class="auth-sent-email">{{ email }}</p>
<p class="auth-sent-note">
Click the link in the email to reset your password.<br>
The link expires in <strong>1 hour</strong>.
</p>
<a href="{{ path('MineSeekerBundle_login') }}" class="auth-submit"
style="text-decoration:none; margin-top:16px;">
Go to Sign In
</a>
</div>
{% else %}
<div class="auth-card">
<h2 class="auth-title">Forgot Password</h2>
<p class="auth-sub">Enter your email and we'll send you a reset link</p>
<form class="auth-form" method="post" action="{{ path('MineSeekerBundle_forgot_password') }}">
<div class="auth-field">
<label for="email" class="auth-label">Email</label>
<div class="auth-input-wrap">
<i class="fa fa-envelope auth-input-icon"></i>
<input
type="email"
id="email"
name="_email"
class="auth-input"
autocomplete="email"
autofocus
required
/>
</div>
</div>
<button type="submit" class="auth-submit">
<i class="fa fa-paper-plane"></i> Send Reset Link
</button>
</form>
<p class="auth-switch">
Remembered it?
<a href="{{ path('MineSeekerBundle_login') }}">Sign in</a>
</p>
</div>
{% endfor %}
</div>
{% endblock %}

View File

@@ -3,81 +3,85 @@
{% block title %} - Sign In{% endblock %}
{% block body %}
<div class="auth-page">
<div class="auth-page">
{% for message in app.flashes('success') %}
<div class="auth-flash auth-flash--success">
<i class="fa fa-check-circle"></i> {{ message }}
</div>
{% endfor %}
{% for message in app.flashes('success') %}
<div class="auth-flash auth-flash--success">
<i class="fa fa-check-circle"></i> {{ message }}
</div>
{% endfor %}
{% for message in app.flashes('error') %}
<div class="auth-flash auth-flash--error">
<i class="fa fa-exclamation-triangle"></i> {{ message }}
</div>
{% endfor %}
{% for message in app.flashes('error') %}
<div class="auth-flash auth-flash--error">
<i class="fa fa-exclamation-triangle"></i> {{ message }}
</div>
{% endfor %}
<div class="auth-card">
<h2 class="auth-title">Sign In</h2>
<p class="auth-sub">Welcome back, commander</p>
<div class="auth-card">
<h2 class="auth-title">Sign In</h2>
<p class="auth-sub">Welcome back, commander</p>
{% if error %}
<div class="auth-error">
<i class="fa fa-exclamation-triangle"></i>
{{ error.messageKey|trans(error.messageData, 'security') }}
</div>
{% endif %}
{% if error %}
<div class="auth-error">
<i class="fa fa-exclamation-triangle"></i>
{{ error.messageKey|trans(error.messageData, 'security') }}
</div>
{% endif %}
<form class="auth-form" method="post" action="{{ path('MineSeekerBundle_login') }}">
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}"/>
<form class="auth-form" method="post" action="{{ path('MineSeekerBundle_login') }}">
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}"/>
<div class="auth-field">
<label for="username" class="auth-label">Username</label>
<div class="auth-input-wrap">
<i class="fa fa-user auth-input-icon"></i>
<input
type="text"
id="username"
name="_username"
class="auth-input"
value="{{ last_username }}"
autocomplete="username"
autofocus
required
/>
</div>
</div>
<div class="auth-field">
<label for="password" class="auth-label">Password</label>
<div class="auth-input-wrap">
<i class="fa fa-lock auth-input-icon"></i>
<input
type="password"
id="password"
name="_password"
class="auth-input"
autocomplete="current-password"
required
/>
</div>
</div>
<label class="auth-remember">
<input type="checkbox" name="_remember_me"/>
<span>Remember me</span>
</label>
<button type="submit" class="auth-submit">
<i class="fa fa-sign-in"></i> Sign In
</button>
</form>
<p class="auth-switch">
No account yet?
<a href="{{ path('MineSeekerBundle_register') }}">Create one</a>
</p>
<div class="auth-field">
<label for="username" class="auth-label">Username</label>
<div class="auth-input-wrap">
<i class="fa fa-user auth-input-icon"></i>
<input
type="text"
id="username"
name="_username"
class="auth-input"
value="{{ last_username }}"
autocomplete="username"
autofocus
required
/>
</div>
</div>
<div class="auth-field">
<label for="password" class="auth-label">Password</label>
<div class="auth-input-wrap">
<i class="fa fa-lock auth-input-icon"></i>
<input
type="password"
id="password"
name="_password"
class="auth-input"
autocomplete="current-password"
required
/>
</div>
</div>
<label class="auth-remember">
<input type="checkbox" name="_remember_me"/>
<span>Remember me</span>
</label>
<button type="submit" class="auth-submit">
<i class="fa fa-sign-in"></i> Sign In
</button>
</form>
<p class="auth-switch">
<a href="{{ path('MineSeekerBundle_forgot_password') }}">Forgot your password?</a>
</p>
<p class="auth-switch">
No account yet?
<a href="{{ path('MineSeekerBundle_register') }}">Create one</a>
</p>
</div>
{% endblock %}
</div>
{% endblock %}

View File

@@ -0,0 +1,57 @@
{% extends 'Game/index.html.twig' %}
{% block title %} - Reset Password{% endblock %}
{% block body %}
<div class="auth-page">
<div class="auth-card">
<h2 class="auth-title">Reset Password</h2>
<p class="auth-sub">Choose a new password for your account</p>
<form class="auth-form" method="post">
<div class="auth-field">
<label for="password" class="auth-label">New Password</label>
<div class="auth-input-wrap">
<i class="fa fa-lock auth-input-icon"></i>
<input
type="password"
id="password"
name="_password"
class="auth-input{% if errors.password is defined %} auth-input--error{% endif %}"
autocomplete="new-password"
autofocus
required
minlength="6"
/>
</div>
{% if errors.password is defined %}
<p class="auth-field-error"><i class="fa fa-exclamation-circle"></i> {{ errors.password }}</p>
{% endif %}
</div>
<div class="auth-field">
<label for="password_confirm" class="auth-label">Confirm New Password</label>
<div class="auth-input-wrap">
<i class="fa fa-lock auth-input-icon"></i>
<input
type="password"
id="password_confirm"
name="_password_confirm"
class="auth-input{% if errors.password_confirm is defined %} auth-input--error{% endif %}"
autocomplete="new-password"
required
/>
</div>
{% if errors.password_confirm is defined %}
<p class="auth-field-error"><i class="fa fa-exclamation-circle"></i> {{ errors.password_confirm }}</p>
{% endif %}
</div>
<button type="submit" class="auth-submit">
<i class="fa fa-key"></i> Set New Password
</button>
</form>
</div>
</div>
{% endblock %}