A5: sign up, sign in, sign out, profile and the base layout (WEB-02, WEB-06, WEB-11, WEB-50..54)
Registration (case-insensitive unique names, 8-256 char passwords, no email), sign-in with a generic error and a fresh session, internal-only ?next=, POST-only sign-out, password change that closes the other sessions. The failed-login backoff, the registration quota and the password-change guard live in the database so every web process shares them; the client IP is the last X-Forwarded-For hop. One responsive stylesheet with light/dark theme, labelled fields, alerts and no inline scripts or styles; Italian error pages and a readable CSRF failure. Mutation checks: open redirects, uncounted failures and a missing CSRF middleware are all caught. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1d4b53d778
commit
efb3e2e702
28 files changed
+1232
-22
No files matched your search
@@ -0,0 +1,6 @@
|
||||
<div class="field{% if field.errors %} has-error{% endif %}">
|
||||
<label for="{{ field.id_for_label }}">{{ field.label }}</label>
|
||||
{{ field }}
|
||||
{% if field.help_text %}<p class="hint" id="{{ field.id_for_label }}-hint">{{ field.help_text }}</p>{% endif %}
|
||||
{% for error in field.errors %}<p class="error" role="alert">{{ error }}</p>{% endfor %}
|
||||
</div>
|
||||
@@ -0,0 +1,4 @@
|
||||
{% if throttled_seconds %}
|
||||
<p class="error box" role="alert">Troppi tentativi. Riprova fra {{ throttled_seconds }} second{{ throttled_seconds|pluralize:"o,i" }}.</p>
|
||||
{% endif %}
|
||||
{% for error in form.non_field_errors %}<p class="error box" role="alert">{{ error }}</p>{% endfor %}
|
||||
@@ -0,0 +1,15 @@
|
||||
{% extends "web/base.html" %}
|
||||
{% block title %}Accedi · PLM Lottery{% endblock %}
|
||||
{% block content %}
|
||||
<section class="card narrow">
|
||||
<h1>Accedi</h1>
|
||||
<form method="post" novalidate>
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="next" value="{{ next }}">
|
||||
{% include "accounts/_form_errors.html" %}
|
||||
{% for field in form %}{% include "accounts/_field.html" %}{% endfor %}
|
||||
<button class="button" type="submit">Accedi</button>
|
||||
</form>
|
||||
<p class="aside">Non hai un account? <a href="{% url 'accounts:register' %}{% if next %}?next={{ next|urlencode }}{% endif %}">Registrati</a>.</p>
|
||||
</section>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,28 @@
|
||||
{% extends "web/base.html" %}
|
||||
{% block title %}Profilo · PLM Lottery{% endblock %}
|
||||
{% block content %}
|
||||
<h1>Profilo</h1>
|
||||
<section class="card">
|
||||
<h2>Il tuo account</h2>
|
||||
<dl class="facts">
|
||||
<dt>Nome utente</dt><dd>{{ user.get_username }}</dd>
|
||||
<dt>Iscritto dal</dt><dd>{{ user.date_joined|date:"j F Y" }}</dd>
|
||||
</dl>
|
||||
</section>
|
||||
<section class="card narrow">
|
||||
<h2>Cambia password</h2>
|
||||
<form method="post" novalidate>
|
||||
{% csrf_token %}
|
||||
{% include "accounts/_form_errors.html" %}
|
||||
{% for field in form %}{% include "accounts/_field.html" %}{% endfor %}
|
||||
<button class="button" type="submit">Aggiorna la password</button>
|
||||
</form>
|
||||
</section>
|
||||
<section class="card narrow">
|
||||
<h2>Esci</h2>
|
||||
<form method="post" action="{% url 'accounts:logout' %}">
|
||||
{% csrf_token %}
|
||||
<button class="button secondary" type="submit">Esci da questo dispositivo</button>
|
||||
</form>
|
||||
</section>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,16 @@
|
||||
{% extends "web/base.html" %}
|
||||
{% block title %}Registrati · PLM Lottery{% endblock %}
|
||||
{% block content %}
|
||||
<section class="card narrow">
|
||||
<h1>Crea il tuo account</h1>
|
||||
<form method="post" novalidate>
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="next" value="{{ next }}">
|
||||
{% include "accounts/_form_errors.html" %}
|
||||
{% for field in form %}{% include "accounts/_field.html" %}{% endfor %}
|
||||
<p class="hint">Non raccogliamo email: se perdi la password non esiste un recupero automatico, solo un reset da parte dell'operatore.</p>
|
||||
<button class="button" type="submit">Registrati</button>
|
||||
</form>
|
||||
<p class="aside">Hai già un account? <a href="{% url 'accounts:login' %}{% if next %}?next={{ next|urlencode }}{% endif %}">Accedi</a>.</p>
|
||||
</section>
|
||||
{% endblock %}
|
||||
Reference in new issue
Block a user