feat: implement user authentication features (registration, activation, and password reset)
All checks were successful
Build and Push Docker Image / build (push) Successful in 46s

- Added email templates for activation and password reset (`activation_email.html`, `password_reset_email.html`, etc.)
- Created forms for registration (`RegisterForm`) and login (`LoginForm`) with custom validation
- Developed new pages for account activation (`activation_success.html`, `activation_invalid.html`), password reset workflow, and profile
- Configured email backend and environment file handling in settings
- Updated header template to conditionally display profile or login links based on authentication status
- Enhanced CSS styles for authentication-related pages and forms
This commit is contained in:
2026-04-15 18:27:23 +02:00
parent 921cea9044
commit 80164b833b
25 changed files with 1198 additions and 59 deletions

View File

@@ -0,0 +1,78 @@
{% extends '_layouts/base.html' %}
{% load static %}
{% block title %}Новый пароль{% endblock %}
{% block add_css %}
<link rel="stylesheet" href="{% static 'css/login.css' %}">
{% endblock %}
{% block content %}
<div class="auth-page">
{% include "_fragments/header.html" %}
<main class="auth-section">
<div class="container auth-layout">
<section class="auth-intro auth-intro--reset">
<p class="auth-kicker">Обновление пароля</p>
<h1 class="auth-title">Придумайте новый пароль</h1>
<p class="auth-description">
Используйте надёжный пароль, который вы ещё не применяли для этого аккаунта.
</p>
</section>
<section class="auth-panel">
{% if validlink %}
<form class="auth-form" method="post">
{% csrf_token %}
{% if form.non_field_errors %}
<div class="auth-alert auth-alert--error">
{% for error in form.non_field_errors %}
<p>{{ error }}</p>
{% endfor %}
</div>
{% endif %}
<div class="auth-field">
<label for="{{ form.new_password1.id_for_label }}">Новый пароль</label>
<input
id="{{ form.new_password1.id_for_label }}"
name="{{ form.new_password1.html_name }}"
type="password"
placeholder="Введите новый пароль"
autocomplete="new-password"
>
{% for error in form.new_password1.errors %}
<p class="auth-field-error">{{ error }}</p>
{% endfor %}
</div>
<div class="auth-field">
<label for="{{ form.new_password2.id_for_label }}">Подтверждение пароля</label>
<input
id="{{ form.new_password2.id_for_label }}"
name="{{ form.new_password2.html_name }}"
type="password"
placeholder="Повторите пароль"
autocomplete="new-password"
>
{% for error in form.new_password2.errors %}
<p class="auth-field-error">{{ error }}</p>
{% endfor %}
</div>
<div class="auth-actions">
<button class="auth-submit" type="submit">Сохранить пароль</button>
</div>
</form>
{% else %}
<div class="auth-copy-block">
<h2 class="auth-panel-title">Ссылка недействительна</h2>
<p class="auth-panel-text">Возможно, ссылка уже использована или срок её действия истёк. Запросите сброс пароля повторно.</p>
<a class="auth-secondary-link" href="{% url 'users:password_reset' %}">Запросить новое письмо</a>
</div>
{% endif %}
</section>
</div>
</main>
{% include "_fragments/footer.html" %}
</div>
{% endblock %}