Browse Source

Revised and redesigned the logic and structure of registration and authorization

TonyKurts 1 month ago
parent
commit
df7a37725d

+ 3 - 0
core/settings.py

@@ -70,6 +70,9 @@ MIDDLEWARE = [
 ]
 
 ROOT_URLCONF = "core.urls"
+LOGIN_URL = "sharix_admin:auth_login"
+LOGIN_REDIRECT_URL = "sharix_admin:home"
+LOGOUT_REDIRECT_URL = "sharix_admin:auth_login"
 
 SESSION_EXPIRE_AT_BROWSER_CLOSE = False
 SESSION_SECURITY_WARN_AFTER = 5

+ 3 - 1
sharix_admin/forms/__init__.py

@@ -1,4 +1,6 @@
-from .login import LoginUserForm
+from .base import BaseForm
+from .auth import *
+
 from .service import *
 from .company import *
 from .document import *

+ 21 - 0
sharix_admin/forms/auth.py

@@ -0,0 +1,21 @@
+from django import forms
+from django.contrib.auth.forms import UserCreationForm, AuthenticationForm, UsernameField
+from django.contrib.auth import get_user_model
+
+from sharix_admin.forms import BaseForm
+
+
+class ShariXSignUpForm(BaseForm, UserCreationForm):
+    """
+    Форма для регистрации пользователей.
+    """
+    class Meta:
+        model = get_user_model()
+        fields = ('last_name', 'first_name', 'middle_name', 'phone_number', 'email', 'username')
+
+
+class ShariXLoginForm(BaseForm, AuthenticationForm):
+    """
+    Форма для авторизации пользователей.
+    """
+    pass

+ 13 - 0
sharix_admin/forms/base.py

@@ -0,0 +1,13 @@
+from django import forms
+
+
+class BaseForm(forms.Form):
+    """
+    Базовая форма, которая автоматически добавляет класс 'form-control' 
+    к каждому полю формы.
+    """
+    def __init__(self, *args, **kwargs):
+        super(BaseForm, self).__init__(*args, **kwargs)
+        for field in self.fields:
+            if 'class' not in self.fields[field].widget.attrs:
+                self.fields[field].widget.attrs.update({'class': 'form-control'})

+ 0 - 15
sharix_admin/forms/login.py

@@ -1,15 +0,0 @@
-from django import forms
-from django.contrib.auth.forms import AuthenticationForm
-from django.contrib.auth import get_user_model
-
-
-class LoginUserForm(AuthenticationForm):
-    password = forms.CharField(label="Пароль",
-        widget=forms.PasswordInput(attrs={'class':'form-control'}))
-
-    username = forms.CharField(label="Номер телефона",
-        widget=forms.TextInput(attrs={'class':'form-control'}))
-
-    class Meta:
-        model = get_user_model()
-        fields = ['username', 'password']

+ 12 - 0
sharix_admin/static/sharix_admin/css/style.css

@@ -117,6 +117,18 @@
     user-select: none;
 }
 
+.field-has-errors .form-control {
+    border: 1px solid rgba(var(--bs-danger-rgb));
+}
+
+.field-has-errors .form-control:focus {
+    box-shadow: 0px 0px 0px 4px var(--bs-danger-border-subtle);
+    border: 1px solid rgba(var(--bs-danger-rgb));
+}
+
+.btn:disabled {
+    opacity: 0.5;
+}
 
 /* Drop files input */
 .drop-container {

BIN
sharix_admin/static/sharix_admin/img/favicon.ico


BIN
sharix_admin/static/sharix_admin/img/logo.png


BIN
sharix_admin/static/sharix_admin/img/user_avatar_1.png


+ 0 - 37
sharix_admin/templates/sharix_admin/auth.html

@@ -1,37 +0,0 @@
-{% extends 'sharix_admin/base.html' %}
-{% load i18n %}
-{% load static %}
-
-{% block content %}
-<div class="text-center" style="margin-top: 150px;">
-    <div class="form-signin" style="width: 100%; max-width:330px; margin: auto; display:block;">
-        <form class="m-2 p-2" method="post">
-            <img class="mb-4" style="height: 100px;" src="{% static 'sharix_admin/img/logo.png' %}" alt="" >
-            <h1 class="h3 mb-3 fw-normal">{% trans 'Log in' %} в {{ NameSystem }}</h1>
-            {% csrf_token %}
-            
-            {% for item in form %}
-                <div class="form-floating my-3">
-                    {{item}}
-                    <label for="{{ item.id_for_label }}">{{ item.label }}</label>
-                </div>
-                {% if item.errors %}
-                    <div class="alert alert-danger" role="alert">
-                        {{ item.errors }}
-                    </div>
-                {% endif %}
-            {% endfor %}
-            {% if form.non_field_errors %}
-                <div class="alert alert-danger" role="alert">
-                    {% trans 'Please, enter the correct phone number and password.' %}
-                </div>
-            {% endif %}
-            <div>
-              <a class="w-100 btn btn-primary btn-lg mb-3" href="{% url 'webservice_running:registration' %}">Регистрация</a>
-              <button class=" w-100 btn btn-primary btn-lg" type="submit">{% trans 'Login' %}</button>
-            </div>
-            <p class="mt-5 mb-3 text-muted">© 2022</p>
-          </form>
-    </div>
-</div>
-{% endblock %}

+ 27 - 0
sharix_admin/templates/sharix_admin/auth/login.html

@@ -0,0 +1,27 @@
+{% extends 'sharix_admin/base.html' %}
+{% load static %}
+
+{% block title %}ShariX Open - Вход{% endblock %}
+
+{% block content %}
+<div class="d-flex vh-100">
+    <div class="m-auto w-100 p-3 d-flex flex-column justify-content-center align-items-center" style="min-width: 320px; max-width: 448px;">
+        <img style="height: 128px;" src="{% static 'sharix_admin/img/logo.png' %}" alt="Логотип">
+        <h1 class="fs-3">Вход в ShariX Open</h1>
+
+        <form class="my-4 w-100" method="post">
+            {% csrf_token %}
+            {% include "sharix_admin/include/form.html" %}
+            
+            <a href="{% url "sharix_admin:auth_reset_password" %}" class="d-block small text-muted text-end mt-2">Забыли пароль? Восстановить</a>
+
+            <div class="mt-4">
+                <button class="w-100 btn btn-primary mb-2" type="submit">Войти</button>
+                <a class="d-block w-100 text-center" href="{% url "sharix_admin:auth_signup" %}">Регистрация</a>
+            </div>
+        </form>
+
+        <small class="text-muted">&#169; ShariX Open {% now "Y" %}</small>
+    </div>
+</div>
+{% endblock %}

+ 17 - 0
sharix_admin/templates/sharix_admin/auth/reset_password.html

@@ -0,0 +1,17 @@
+{% extends 'sharix_admin/base.html' %}
+{% load static %}
+
+{% block title %}ShariX Open - Восстановление пароля{% endblock %}
+
+{% block content %}
+<div class="d-flex vh-100">
+    <div class="m-auto w-100 p-4 d-flex flex-column justify-content-center align-items-center text-center">
+        <div class="mb-4">
+            <h1 class="fs-2">Приносим свои извинения, автоматическое восстановление паролей сейчас не работает!</h1>
+            <a href="{% url "sharix_admin:auth_login" %}">Вернуться на страницу входа</a>
+        </div>
+
+        <small class="text-muted">&#169; ShariX Open {% now "Y" %}</small>
+    </div>
+</div>
+{% endblock %}

+ 47 - 0
sharix_admin/templates/sharix_admin/auth/signup.html

@@ -0,0 +1,47 @@
+{% extends 'sharix_admin/base.html' %}
+{% load static %}
+
+{% block title %}ShariX Open - Регистрация{% endblock %}
+
+{% block content %}
+<div class="d-flex vh-100">
+    <div class="m-auto w-100 p-3 d-flex flex-column justify-content-center align-items-center" style="min-width: 320px; max-width: 448px;">
+        <img style="height: 128px;" src="{% static 'sharix_admin/img/logo.png' %}" alt="Логотип">
+        <h1 class="fs-3">Регистрация в ShariX Open</h1>
+
+        <form class="my-4 w-100" method="post">
+            {% csrf_token %}
+            {% include "sharix_admin/include/form.html" %}
+            
+            <div class="form-check text-muted">
+                <input type="checkbox" class="form-check-input" id="checkbox-user-agreement">
+                <label class="form-check-label" for="checkbox-user-agreement">
+                    Я соглашаюсь с <a class="link-secondary" href="https://wiki.sharix-app.org/doku.php/open/doc/usage" target="_blank">пользовательским соглашением</a>
+                </label>
+            </div>
+
+            <div class="mt-4">
+                <!-- По умолчанию кнопка "Зарегистрироваться" отключена -->
+                <button id="btn-submit-signup" class="w-100 btn btn-primary mb-2" type="submit" disabled>Зарегистрироваться</button>
+                <a class="d-block w-100 text-center" href="{% url "sharix_admin:auth_login" %}">Вход</a>
+            </div>
+        </form>
+
+        <small class="text-muted">&#169; ShariX Open {% now "Y" %}</small>
+    </div>
+</div>
+
+<script>
+    // Логика, запрещающая нажатие на кнопку "Зарегистрироваться", пока пользователь не согласится с "Пользовательским соглашением"
+    document.addEventListener('DOMContentLoaded', function() {
+        const checkboxEl = document.getElementById('checkbox-user-agreement');
+        const submitBtnEl = document.getElementById('btn-submit-signup');
+
+        // Обработчик события изменения состояния чекбокса
+        checkboxEl.addEventListener('change', function() {
+            if (checkboxEl.checked) submitBtnEl.removeAttribute('disabled');
+            else submitBtnEl.setAttribute('disabled', 'disabled');
+        });
+    });
+</script>
+{% endblock %}

+ 13 - 7
sharix_admin/templates/sharix_admin/base.html

@@ -1,21 +1,27 @@
 {% load static %}
 
 <!DOCTYPE html>
-<html lang="en">
+<html lang="ru">
 <head>
     <meta charset="UTF-8">
-    <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <link rel="shortcut icon" href="{% static 'sharix_admin/img/logo.png' %}">
+
     <link rel="stylesheet" href="{% static 'sharix_admin/css/bootstrap.min.css' %}">
+    <link rel="stylesheet" href="{% static 'fontawesomefree/css/fontawesome.css' %}">
+    <link rel="stylesheet" href="{% static 'fontawesomefree/css/brands.css' %}">
+    
     <link rel="stylesheet" href="{% static 'drf-yasg/service_type.css' %}">
     <link rel="stylesheet" href="{% static 'drf-yasg/colors2.css' %}">
     <link rel="stylesheet" href="{% static 'sharix_admin/css/style.css' %}">
-
-    <link href="{% static 'fontawesomefree/css/fontawesome.css' %}" rel="stylesheet" type="text/css">
-    <link href="{% static 'fontawesomefree/css/brands.css' %}" rel="stylesheet" type="text/css">
     
-    <title>{{ title }}</title>
+    <link rel="icon" href="{% static 'sharix_admin/img/favicon.ico' %}" type="image/x-icon">
+    <title>
+        {% if title %}
+            {{ title }}
+        {% else %}
+            {% block title %}{% endblock %}
+        {% endif %}
+    </title>
 </head>
 
 <body>

+ 16 - 10
sharix_admin/templates/sharix_admin/include/form.html

@@ -1,22 +1,28 @@
 {% for field in form %}
-    <div class="w-100 mb-3">
-        <label for="{{ field.id_for_label }}" class="form-label">{{ field.label }}</label>
-        {{ field }}
-        {% if field.help_text %}
-            <small class="form-text text-muted">{{ field.help_text }}</small>
-        {% endif %}
+    <div class="w-100 mb-2 {% if field.errors %}field-has-errors{% endif %}">
+        <div class="form-floating">
+            {{ field }}
+            <label for="{{ field.id_for_label }}" class="form-label">{{ field.label }}</label>
+        </div>
+
         {% if field.errors %}
-            <ul class="alert alert-danger list-style-none">
+            <div class="mt-1">
                 {% for error in field.errors %}
-                    <li>{{ error }}</li>
+                    <small class="d-block text-danger">* {{ error }}</small>
                 {% endfor %}
-            </ul>
+            </div>
         {% endif %}
+
+        {% comment %}
+            {% if field.help_text %}
+                <small class="form-text d-block text-muted mt-1">{{ field.help_text }}</small>
+            {% endif %}
+        {% endcomment %}
     </div>
 {% endfor %}
 
 {% if form.non_field_errors %}
-    <div class="alert alert-danger">
+    <div class="alert alert-danger mb-0 small">
         {% for error in form.non_field_errors %}
             {{ error }}
         {% endfor %}

+ 28 - 22
sharix_admin/templates/sharix_admin/index.html

@@ -15,7 +15,7 @@
 
     <ul class="d-flex flex-column nav nav-pills rounded box-shadow border p-2 bg-white">
       <li class="nav-item">
-        <a href="{% url "home" %}" class="nav-link {% if current_page == "index" %}active rounded{% endif %}">
+        <a href="{% url "sharix_admin:home" %}" class="nav-link {% if current_page == "index" %}active rounded{% endif %}">
           <div class="link d-flex align-items-center">
             <img
               class="nav-img"
@@ -60,7 +60,7 @@
         </a>
       </li>
       <li class="nav-item">
-        <a href="{% url 'partners' %}" class="nav-link {% if current_page == "partners" %}active rounded{% endif %}">
+        <a href="{% url "sharix_admin:partners" %}" class="nav-link {% if current_page == "partners" %}active rounded{% endif %}">
           <div class="link d-flex align-items-center">
             <img
               class="nav-img"
@@ -76,7 +76,7 @@
       </li>
       {% if not is_partner_admin %}
         <li class="nav-item">
-          <a href="{% url 'cooperate' %}" class="nav-link {% if current_page == "cooperate" %}active rounded{% endif %}">
+          <a href="{% url "sharix_admin:cooperate" %}" class="nav-link {% if current_page == "cooperate" %}active rounded{% endif %}">
             <div class="link d-flex align-items-center">
               <img
                 class="nav-img"
@@ -92,7 +92,7 @@
         </li>
       {% endif %}
       {% comment %} <li class="nav-item">
-        <a href="{% url 'user_information' %}" class="nav-link {% if current_page == "none" %}active rounded{% endif %}">
+        <a href="{% url 'sharix_admin:user_information' %}" class="nav-link {% if current_page == "none" %}active rounded{% endif %}">
           <div class="link d-flex align-items-center">
             <img
               class="nav-img"
@@ -107,7 +107,7 @@
         </a>
       </li> {% endcomment %}
       <li class="nav-item">
-        <a href="{% url 'service_type' %}" class="nav-link {% if current_page == "service_type" %}active rounded{% endif %}">
+        <a href="{% url 'sharix_admin:service_type' %}" class="nav-link {% if current_page == "service_type" %}active rounded{% endif %}">
           <div class="link d-flex align-items-center">
             <img
               class="nav-img"
@@ -122,7 +122,7 @@
         </a>
       </li>
       <li class="nav-item">
-        <a href="{% url 'transactions' %}" class="nav-link {% if current_page == "transactions" %}active rounded{% endif %}">
+        <a href="{% url 'sharix_admin:transactions' %}" class="nav-link {% if current_page == "transactions" %}active rounded{% endif %}">
           <div class="link d-flex align-items-center">
             <img
               class="nav-img"
@@ -138,7 +138,7 @@
       </li>
       {% if is_partner_admin %}
         <li class="nav-item">
-          <a href="{% url 'partner_detail' %}" class="nav-link {% if current_page == 'partner' %}active rounded{% endif %}">
+          <a href="{% url 'sharix_admin:partner_detail' %}" class="nav-link {% if current_page == 'partner' %}active rounded{% endif %}">
             <div class="link d-flex align-items-center">
               <img
                 class="nav-img"
@@ -154,7 +154,7 @@
         </li>
       {% endif %}
       {% comment %} <li class="nav-item">
-        <a href="{% url 'service_information-add' %}" class="nav-link {% if current_page == "service_info" %}active rounded{% endif %}">
+        <a href="{% url 'sharix_admin:service_information-add' %}" class="nav-link {% if current_page == "service_info" %}active rounded{% endif %}">
           <div class="link d-flex align-items-center">
             <img
               class="nav-img"
@@ -169,7 +169,7 @@
         </a>
       </li> {% endcomment %}
       <li class="nav-item">
-        <a href="{% url 'payment' %}" class="nav-link {% if current_page == "payment" %}active rounded{% endif %}">
+        <a href="{% url 'sharix_admin:payment' %}" class="nav-link {% if current_page == "payment" %}active rounded{% endif %}">
           <div class="link d-flex align-items-center">
             <img
               class="nav-img"
@@ -197,20 +197,26 @@
   </div>
 
   <footer class="d-flex justify-content-between mt-3 p-2 align-items-center border rounded box-shadow">
-    <div>
-        <img class="rounded-circle" style="height: 48px" src="{% static 'sharix_admin/img/user_avatar_1.png' %}"/>
-        <span class="mx-2">{{ phone }}</span>
+    <div class="d-flex align-items-center">
+        <div class="d-flex justify-content-center align-items-center rounded-circle bg-secondary-subtle p-3">
+          <i class="fa-solid fa-user"></i>
+        </div>
+        <span class="mx-2 text-nowrap">{{ phone }}</span>
+        
+        <form method="post" action="{% url "sharix_admin:auth_logout" %}">
+          {% csrf_token %}
+          <button class="btn btn-sm btn-outline-secondary" type="submit">
+            Выйти
+            <i class="fa-solid fa-right-from-bracket ms-1"></i>
+          </button>
+        </form>
     </div>
-    <div>
-        <a class="ms-4" href="{% url 'contact' %}">{% trans 'Contacts' %}</a>
-        <a class="ms-4" href="https://wiki.sharix-app.org/doku.php/sharix/legal/soglashenie_s_servisom_na_ispolzovanie_platformy_sharix">{% trans 'Terms of use' %}</a>
-        <a class="ms-4 me-1" href="https://wiki.sharix-app.org/doku.php/sharix/legal/politika_konfidencialnosti_platformy_sharix">{% trans 'Privacy policy' %}</a>
-        <svg width="24" viewBox="0 0 24 24" fill="none" stroke="#479FF8" xmlns="http://www.w3.org/2000/svg">
-          <text x="9" y="16">
-              <a href="https://wiki.sharix-app.org/doku.php">?</a>
-          </text>
-          <circle cx="12" cy="12" r="11.5"/>
-        </svg>
+
+    <div class="d-flex gap-3">
+        <a href="{% url 'contact' %}">{% trans 'Contacts' %}</a>
+        <a href="https://wiki.sharix-app.org/doku.php/sharix/legal/soglashenie_s_servisom_na_ispolzovanie_platformy_sharix">{% trans 'Terms of use' %}</a>
+        <a href="https://wiki.sharix-app.org/doku.php/sharix/legal/politika_konfidencialnosti_platformy_sharix">{% trans 'Privacy policy' %}</a>
+        <a href="https://wiki.sharix-app.org/doku.php">Помощь</a>
     </div>
   </footer>
 </div>

+ 3 - 4
sharix_admin/templates/sharix_admin/main.html

@@ -14,9 +14,8 @@
                 <li class="list-group-item"><a  href="https://wiki.sharix-app.org/doku.php/sharix/legal/pravila_okazanija_uslug">{% trans 'Rules for the provision of services' %}</a></li>
                 <li class="list-group-item"><a  href="https://wiki.sharix-app.org/doku.php/sharix/legal/porjadok_okazanija_uslug">{% trans 'Procedure for the provision of services' %}</a></li>
                 <li class="list-group-item"><a  href="https://wiki.sharix-app.org/doku.php/sharix/legal/perechen_uslug_platformy">{% trans 'List of services' %}</a></li>
-                <li class="list-group-item"><a  href="{% url 'schemav1' %}">{% trans 'Scheme 1' %}</a> / <a  href="{% url 'schemav2' %}">{% trans 'Scheme 2' %}</a> / <a  href="{% url 'schema' %}">{% trans 'Scheme 3' %}</a> / <a  href="{% url 'schema-redoc' %}">{% trans 'API Docs' %}</a></li>
-            
-                </ul>
+                <li class="list-group-item"><a  href="{% url 'sharix_admin:schemav1' %}">{% trans 'Scheme 1' %}</a> / <a  href="{% url 'sharix_admin:schemav2' %}">{% trans 'Scheme 2' %}</a> / <a  href="{% url 'sharix_admin:schema' %}">{% trans 'Scheme 3' %}</a> / <a  href="{% url 'sharix_admin:schema-redoc' %}">{% trans 'API Docs' %}</a></li>
+            </ul>
         </div>
         <div class="col-6 text-end">
             {% blocktrans trimmed with request.user.username as user %}
@@ -31,7 +30,7 @@
             {% blocktrans trimmed with wallet.balance as balance %}
             <p>Balance: <b>{{ balance }} points</b></p>
             {% endblocktrans %}
-            <a href="{% url 'balance' %}" class="btn btn-success">{% trans 'Buy points' %}</a>
+            <a href="{% url 'sharix_admin:balance' %}" class="btn btn-success">{% trans 'Buy points' %}</a>
         </div>
     </div>
 </div>  

+ 18 - 8
sharix_admin/urls.py

@@ -1,17 +1,30 @@
+from django.contrib.auth.views import LogoutView
+from django.contrib.auth.decorators import login_required
 from django.urls import path, include, re_path
-from sharix_admin.views import *
-from .apiviews import *
-from rest_framework import routers
 from django_spaghetti.views import Plate
 from schema_graph.views import Schema
-from django.conf import settings
-from django.contrib.auth.decorators import login_required
+from rest_framework import routers
+
+from sharix_admin.views import *
+from sharix_admin.apiviews import *
+
 
 router = routers.SimpleRouter()
 router.register(r'sharix-users', SharixUserMVS)
 router.register(r'group', GroupMVS)
 
+app_name = "sharix_admin"
+
 urlpatterns = [
+    # Регистрация / Вход / Выход
+    path('auth/signup/', ShariXSignUpView.as_view(), name="auth_signup"),
+    path('auth/login/', ShariXLoginView.as_view(), name='auth_login'),
+    path('auth/logout/', login_required(LogoutView.as_view()), name="auth_logout"),
+    path('auth/reset-password/', ShariXResetPasswordView.as_view(), name='auth_reset_password'),
+
+    # --- Ниже страницы, которые требуют ревью ---
+
+    # Главная
     path('', login_required(IndexView.as_view()), name='home'),
     path('transactions/', login_required(TransactionsView.as_view()), name='transactions'),
     path('payment/', login_required(PaymentView.as_view()), name='payment'),
@@ -25,10 +38,7 @@ urlpatterns = [
     path('partner/doc/<str:doc_code>/upload', login_required(PartnerDocUploadView.as_view()), name='partner_doc_upload'),
     path('partner/doc/<str:doc_code>', login_required(PartnerDocView.as_view()), name='partner_doc'),
 
-
-    path('accounts/login/', LoginSharix.as_view(), name='authweb'),
     path('transactions/<int:trans_id>/', trans_id, name='transid'),
-    path('logout/', logout_view, name='logoutweb'),
     path('balance/', balance, name='balance'),
    
     path('partners/', login_required(PartnersListView.as_view()), name='partners'),

+ 2 - 1
sharix_admin/views/__init__.py

@@ -1,3 +1,5 @@
+from .auth import *
+
 from .index import *
 from .transactions import *
 from .service import *
@@ -9,7 +11,6 @@ from .resource import *
 from .partners import *
 from .partner_info import *
 from .provider import *
-from .login import *
 from .cooperate import *
 from .payment import *
 from .balance import *

+ 32 - 0
sharix_admin/views/auth.py

@@ -0,0 +1,32 @@
+from django.views.generic.edit import CreateView
+from django.views.generic import TemplateView
+from django.contrib.auth.views import LoginView
+from django.urls import reverse_lazy
+
+from sharix_admin.forms import ShariXSignUpForm, ShariXLoginForm
+
+
+class ShariXSignUpView(CreateView):
+    """
+    Представление для регистрации пользователей.
+    """
+    form_class = ShariXSignUpForm
+    template_name = 'sharix_admin/auth/signup.html'
+    success_url = reverse_lazy('sharix_admin:auth_login')
+
+
+class ShariXLoginView(LoginView):
+    """
+    Представление для входа в систему.
+    """
+    form_class = ShariXLoginForm
+    template_name = "sharix_admin/auth/login.html"
+    redirect_authenticated_user = True
+
+
+# FIXME: Восстановления паролей сейчас не работает. Установлена заглушка.
+class ShariXResetPasswordView(TemplateView):
+    """
+    Представление для восстановления пароля.
+    """
+    template_name = "sharix_admin/auth/reset_password.html"

+ 0 - 17
sharix_admin/views/login.py

@@ -1,17 +0,0 @@
-from django.http import HttpResponseRedirect
-from sharix_admin.forms import LoginUserForm
-from django.contrib.auth.views import LoginView
-from django.urls import reverse_lazy, reverse
-from django.contrib.auth import logout
-
-def logout_view(request):
-    logout(request)
-    return HttpResponseRedirect(reverse('authweb'))
-
-class LoginSharix(LoginView):
-    form_class = LoginUserForm
-    template_name = 'sharix_admin/auth.html'
-
-    
-    def get_success_url(self):
-        return reverse_lazy('home')