Merge branch 'refs/heads/ivan' into andrei

# Conflicts:
#	CineSync/templates/users/profile.html
This commit is contained in:
Андрей Дувакин 2024-04-22 22:13:24 +05:00
commit 84e66e7978
6 changed files with 28 additions and 49 deletions

View File

@ -28,9 +28,6 @@
</form>
{% endcomment %}
<br>
<a href="{% url 'users:password_reset' %}"
class="link-primary link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Восстановить
пароль</a>
<a href="{% url 'users:signup' %}"
class="link-primary link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Создать
аккаунт</a>

View File

@ -0,0 +1,12 @@
{% extends "base.html" %}
{% load static %}
{% block title %}
Изменить пароль
{% endblock title %}
{% block content %}
<link href="{% static 'css/users/password_change.css' %}" rel="stylesheet">
<div class="password_change_block">
<h1>Смена пароля</h1>
{% include "includes/form.html" with form=form %}
</div>
{% endblock %}

View File

@ -0,0 +1,15 @@
{% extends "base.html" %}
{% load static %}
{% block title %}
Смена пароля
{% endblock %}
{% block content %}
<link href="{% static 'css/users/password_change_success.css' %}" rel="stylesheet">
<div class="info_block">
<div class="text_block">
<h1 class="change_success_title">Пароль успешно изменен</h1>
<img class="change_success_image" src="{% static 'img/success.png' %}">
<a class="btn btn-primary change_success_btn" href="{% url 'home:homepage' %}">На главную</a>
</div>
</div>
{% endblock %}

View File

@ -46,6 +46,6 @@
<button class="btn btn-primary" type="submit">Сохранить изменения</button>
</form>
<a class="btn btn-danger" type="submit" href="{% url 'users:logout' %}">Выйти</a>
<a href="{% url "users:password_change" %}">Сменить пароль</a>
<a href="{% url 'users:password_change' %}">Сменить пароль</a>
</div>
{% endblock content %}

View File

@ -4,7 +4,6 @@ from django.forms import DateInput, ModelForm
from django.contrib.auth.forms import (
AuthenticationForm,
PasswordChangeForm,
PasswordResetForm,
SetPasswordForm,
UserChangeForm,
UserCreationForm,
@ -45,16 +44,6 @@ class CustomSetPasswordForm(SetPasswordForm):
fields = ('old_password', 'new_password', 'approve_new_password')
class CustomPasswordResetForm(PasswordResetForm):
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
for field in self.visible_fields():
field.field.widget.attrs['class'] = 'form-control'
class Meta(forms.ModelForm):
fields = ('old_password', 'new_password', 'approve_new_password')
class SignUpForm(UserCreationForm):
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)

View File

@ -6,7 +6,6 @@ from django.urls import reverse_lazy
from users.forms import (
CustomAuthenticationForm,
CustomPasswordChangeForm,
CustomPasswordResetForm,
CustomSetPasswordForm,
)
from users.views import profile, signup
@ -48,39 +47,6 @@ urlpatterns = [
),
name='password_change_done',
),
path(
'password_reset/',
views.PasswordResetView.as_view(
template_name='users/password_reset.html',
email_template_name='users/password_reset_email.html',
form_class=CustomPasswordResetForm,
success_url=reverse_lazy('users:password_reset_done'),
),
name='password_reset',
),
path(
'password_reset/done/',
views.PasswordResetDoneView.as_view(
template_name='users/password_reset_done.html',
),
name='password_reset_done',
),
path(
'password_reset_confirm/<uidb64>/<token>/',
views.PasswordResetConfirmView.as_view(
form_class=CustomSetPasswordForm,
template_name='users/password_reset_confirm.html',
success_url=reverse_lazy('users:password_reset_confirm_complete'),
),
name='password_reset_confirm',
),
path(
'password_reset_complete/done/',
views.PasswordResetCompleteView.as_view(
template_name='users/password_reset_complete.html',
),
name='password_reset_complete',
),
path('signup/', signup, name='signup'),
path('profile/', login_required(profile), name='profile'),
]