Browse Source

Add logout view

pull/10/head
Hironsan 6 years ago
parent
commit
13bbd78927
4 changed files with 12 additions and 1 deletions
  1. 1
      doccano/app/app/settings.py
  2. 3
      doccano/app/app/urls.py
  3. BIN
      doccano/app/db.sqlite3
  4. 9
      doccano/app/server/templates/base.html

1
doccano/app/app/settings.py

@ -126,3 +126,4 @@ USE_TZ = True
STATIC_URL = '/static/'
LOGIN_REDIRECT_URL = '/projects/'
LOGOUT_REDIRECT_URL = '/'

3
doccano/app/app/urls.py

@ -15,12 +15,13 @@ Including another URLconf
"""
from django.contrib import admin
from django.urls import path, include
from django.contrib.auth.views import LoginView, PasswordResetView
from django.contrib.auth.views import LoginView, PasswordResetView, LogoutView
urlpatterns = [
path('projects/', include('server.urls')),
path('admin/', admin.site.urls),
path('login/', LoginView.as_view(template_name='login.html'), name='login'),
path('logout/', LogoutView.as_view(), name='logout'),
path('password_reset/', PasswordResetView.as_view(), name='password_reset'),
]

BIN
doccano/app/db.sqlite3

9
doccano/app/server/templates/base.html

@ -43,12 +43,21 @@
</a>
</p>
<p class="control">
{% if use.is_authenticated %}
<a class="button is-small is-primary is-outlined" href="{% url 'login' %}">
<span class="icon">
<i class="fa fa-user"></i>
</span>
<span>Login</span>
</a>
{% else %}
<a class="button is-small is-outlined" href="{% url 'logout' %}">
<span class="icon">
<i class="fa fa-user"></i>
</span>
<span>Logout</span>
</a>
{% endif %}
</p>
</div>
</div>

Loading…
Cancel
Save