add register, login, logout views

This commit is contained in:
Matteo Rosati
2026-02-11 11:53:06 +01:00
parent 160a8bf020
commit 6bce72e866
13 changed files with 402 additions and 3 deletions

View File

@@ -0,0 +1,37 @@
{% extends 'frontend/base.html' %}
{% block title %}Login{% endblock %}
{% block content %}
<main class="auth-shell">
<section class="auth-card">
<header class="auth-header">
<p class="auth-kicker">DroneWars</p>
<h1 class="auth-title">Welcome back</h1>
<p class="auth-subtitle">Log in to continue your flight plan.</p>
</header>
{% if messages %}
<div class="auth-messages">
{% for message in messages %}
<p class="auth-message">{{ message }}</p>
{% endfor %}
</div>
{% endif %}
<form method="post" class="auth-form">
{% csrf_token %}
<label class="auth-field">
<span>Email</span>
<input type="email" name="email" autocomplete="email" required>
</label>
<label class="auth-field">
<span>Password</span>
<input type="password" name="password" autocomplete="current-password" required>
</label>
<button type="submit" class="auth-submit">Log in</button>
</form>
<footer class="auth-footer">
<p>No account yet? <a href="{% url 'register' %}">Create one</a>.</p>
</footer>
</section>
</main>
{% endblock %}

View File

@@ -0,0 +1,22 @@
{% extends 'frontend/base.html' %}
{% block title %}Logout{% endblock %}
{% block content %}
<main class="auth-shell">
<section class="auth-card">
<header class="auth-header">
<p class="auth-kicker">DroneWars</p>
<h1 class="auth-title">Log out</h1>
<p class="auth-subtitle">Are you sure you want to end this session?</p>
</header>
<form method="post" class="auth-form">
{% csrf_token %}
<button type="submit" class="auth-submit">Confirm logout</button>
</form>
<footer class="auth-footer">
<p>Changed your mind? <a href="{% url 'home' %}">Return home</a>.</p>
</footer>
</section>
</main>
{% endblock %}

View File

@@ -0,0 +1,45 @@
{% extends 'frontend/base.html' %}
{% block title %}Register{% endblock %}
{% block content %}
<main class="auth-shell">
<section class="auth-card">
<header class="auth-header">
<p class="auth-kicker">DroneWars</p>
<h1 class="auth-title">Create your pilot profile</h1>
<p class="auth-subtitle">Sign up with your email and a secure password.</p>
</header>
{% if messages %}
<div class="auth-messages">
{% for message in messages %}
<p class="auth-message">{{ message }}</p>
{% endfor %}
</div>
{% endif %}
<form method="post" class="auth-form">
{% csrf_token %}
<label class="auth-field">
<span>Email</span>
<input type="email" name="email" autocomplete="email" required>
</label>
<label class="auth-field">
<span>Display name</span>
<input type="text" name="display_name" maxlength="150" autocomplete="nickname" required>
</label>
<label class="auth-field">
<span>Password</span>
<input type="password" name="password" autocomplete="new-password" required>
</label>
<label class="auth-field">
<span>Confirm password</span>
<input type="password" name="password_confirm" autocomplete="new-password" required>
</label>
<button type="submit" class="auth-submit">Create account</button>
</form>
<footer class="auth-footer">
<p>Already have an account? <a href="{% url 'login' %}">Log in</a>.</p>
</footer>
</section>
</main>
{% endblock %}