fix queue
This commit is contained in:
1 parent
049cc41afc
commit
9a1c99cbd3
14 files changed
+237
-32
No files matched your search
+13
-1
@@ -1,4 +1,16 @@
|
||||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
|
||||
app_name = "accounts"
|
||||
urlpatterns = [path("login/", views.customer_login, name="login"),path("login/password/",views.customer_password_login,name="password_login"), path("login/otp/", views.verify_otp, name="otp"),path("profile/",views.customer_profile,name="profile"), path("logout/", views.logout_view, name="logout"), path("staff/login/", views.staff_login, name="staff_login"), path("staff/logout/", views.logout_view, name="staff_logout"), path("t/<str:token>/", views.consume_magic_link, name="magic")]
|
||||
urlpatterns = [
|
||||
path("", views.home, name="home"),
|
||||
path("login/", views.customer_login, name="login"),
|
||||
path("login/password/", views.customer_password_login, name="password_login"),
|
||||
path("login/otp/", views.verify_otp, name="otp"),
|
||||
path("profile/", views.customer_profile, name="profile"),
|
||||
path("logout/", views.logout_view, name="logout"),
|
||||
path("staff/login/", views.staff_login, name="staff_login"),
|
||||
path("staff/logout/", views.logout_view, name="staff_logout"),
|
||||
path("t/<str:token>/", views.consume_magic_link, name="magic"),
|
||||
]
|
||||
@@ -3,8 +3,7 @@ from django.conf import settings
|
||||
from django.contrib.auth import login, logout
|
||||
from django.shortcuts import get_object_or_404, redirect, render
|
||||
from django.utils import timezone
|
||||
from django.views.decorators.http import require_http_methods
|
||||
from django.views.decorators.http import require_POST
|
||||
from django.views.decorators.http import require_GET, require_http_methods, require_POST
|
||||
from .forms import CustomerPasswordLoginForm, CustomerProfileForm, MobileForm, OTPForm, StaffLoginForm
|
||||
from apps.customers.models import CustomerProfile
|
||||
from django.contrib.auth.decorators import login_required
|
||||
@@ -21,6 +20,11 @@ def _authenticated_home(request):
|
||||
if not request.user.is_authenticated: return None
|
||||
return redirect("staff_tickets:list" if request.user.account_type==User.AccountType.STAFF else "tickets:list")
|
||||
|
||||
@require_GET
|
||||
def home(request):
|
||||
"""Send every visitor to the correct login or authenticated workspace."""
|
||||
return _authenticated_home(request) or redirect("accounts:login")
|
||||
|
||||
@require_http_methods(["GET", "POST"])
|
||||
def customer_login(request):
|
||||
if response:=_authenticated_home(request): return response
|
||||
|
||||
Reference in new issue
Block a user