Authentication - Add logout view and set login url in settings
This commit is contained in:
parent
9f725b4c46
commit
0bded3afc7
@ -72,6 +72,7 @@ MIDDLEWARE = [
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'EpisodesCommunity.urls'
|
||||
LOGIN_URL = '/login'
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
|
@ -3,6 +3,7 @@ from django.conf.urls import url
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^logout/$', views.LogoutView),
|
||||
url(r'^login/redirect$', views.LoginRedirect.as_view()),
|
||||
url(r'^login$', views.Login.as_view()),
|
||||
url(r'^$', views.LandingPage.as_view()),
|
||||
|
@ -6,6 +6,7 @@ from django.conf import settings
|
||||
from django.http import HttpResponse
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.db.models import Max
|
||||
from django.contrib.auth.views import logout
|
||||
import requests
|
||||
import hashlib
|
||||
import json
|
||||
@ -50,6 +51,10 @@ class Login(View):
|
||||
response['Location'] = url
|
||||
return response
|
||||
|
||||
def LogoutView(request):
|
||||
logout(request)
|
||||
return HttpResponseRedirect('/')
|
||||
|
||||
def generateState(request):
|
||||
request.session.save()
|
||||
|
||||
|
Reference in New Issue
Block a user