From 0e9aa2b319c3eca058a695c197ca4d96e97b2b16 Mon Sep 17 00:00:00 2001 From: Egor Matveev Date: Sun, 21 Nov 2021 12:03:04 +0300 Subject: [PATCH] change password removed --- Main/views/AccountView.py | 17 ----------------- templates/account.html | 14 -------------- 2 files changed, 31 deletions(-) diff --git a/Main/views/AccountView.py b/Main/views/AccountView.py index 9d795df..2a738bb 100644 --- a/Main/views/AccountView.py +++ b/Main/views/AccountView.py @@ -1,4 +1,3 @@ -from django.contrib.auth import authenticate, login from django.contrib.auth.models import User from SprintLib.BaseView import BaseView @@ -33,23 +32,7 @@ class AccountView(BaseView): self.request.user.userinfo.save() return "/account" - def post_change_password(self): - password = self.request.POST["password"].strip() - new_password = self.request.POST["new_password"].strip() - user = authenticate(username=self.request.user.username, password=password) - if not user: - return "/account?error_message=Неправильно указан пароль" - if len(new_password) < 8: - return "/account?error_message=Пароль слишком слабый" - if new_password != self.request.POST["repeat"]: - return "/account?error_message=Пароли не совпадают" - self.request.user.set_password(new_password) - self.request.user.save() - login(self.request, self.request.user) - return "/account?error_message=Пароль успешно установлен" - def post_notifications(self): - self.request.user.userinfo.telegram_chat_id = self.request.POST['chat_id'] for attr in dir(self.request.user.userinfo): if attr.startswith('notification'): setattr(self.request.user.userinfo, attr, attr in self.request.POST.keys()) diff --git a/templates/account.html b/templates/account.html index 0d2445c..46fb790 100644 --- a/templates/account.html +++ b/templates/account.html @@ -95,26 +95,12 @@ -

- {% if owner %} -

{{ error_message }}

-
- {% csrf_token %} - -

Смена пароля

-
-
-
- -
- {% endif %} {% if owner %}

Уведомления

{% csrf_token %} - Бот