add logout

This commit is contained in:
Cayo Puigdefabregas 2023-10-09 10:55:50 +02:00
parent d0926a8f86
commit 4a4fea1464
4 changed files with 8 additions and 6 deletions

View File

@ -51,9 +51,9 @@
<div class="nav-item text-nowrap">
<i id="user-avatar" class="bi bi-person-circle"></i>
<a class="navbar-sub-brand px-3" href="#">Lorena</a>
<span class="logout">
<a class="logout" href="{% url 'idhub:logout' %}">
<i class="fa-solid fa-arrow-right-from-bracket"></i>
</span>
</a>
</div>
</div>
</header>

View File

@ -51,9 +51,9 @@
<div class="nav-item text-nowrap">
<i id="user-avatar" class="bi bi-person-circle"></i>
<a class="navbar-sub-brand px-3" href="#">Lorena</a>
<span class="logout">
<a class="logout" href="{% url 'idhub:logout' %}">
<i class="fa-solid fa-arrow-right-from-bracket"></i>
</span>
</a>
</div>
</div>
</header>

View File

@ -14,7 +14,7 @@ Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.urls import path
from . import views
@ -24,6 +24,7 @@ app_name = 'idhub'
urlpatterns = [
# path("", views.index, name="index"),
path('login/', views.LoginView.as_view(), name='login'),
path('logout/', auth_views.LogoutView.as_view(), name='logout'),
path('user/dashboard/', views.UserDashboardView.as_view(), name='user_dashboard'),
path('admin/dashboard/', views.AdminDashboardView.as_view(), name='user_dashboard'),
path('admin/dashboard/', views.AdminDashboardView.as_view(), name='admin_dashboard'),
]

View File

@ -124,3 +124,4 @@ STATIC_URL = 'static/'
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
LOGOUT_REDIRECT_URL = 'idhub:login'