Fixes csrf failure logging on from multiple tabs
This commit is contained in:
parent
310d4a1f59
commit
5e0a1749f3
|
@ -6,6 +6,7 @@ from django.shortcuts import get_object_or_404, redirect
|
||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
from django.views import View
|
from django.views import View
|
||||||
|
|
||||||
from bookwyrm import forms, models
|
from bookwyrm import forms, models
|
||||||
|
@ -13,6 +14,7 @@ from bookwyrm.settings import DOMAIN
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable= no-self-use
|
# pylint: disable= no-self-use
|
||||||
|
@method_decorator(csrf_exempt, name='dispatch')
|
||||||
class Login(View):
|
class Login(View):
|
||||||
''' authenticate an existing user '''
|
''' authenticate an existing user '''
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
|
@ -29,6 +31,8 @@ class Login(View):
|
||||||
|
|
||||||
def post(self, request):
|
def post(self, request):
|
||||||
''' authentication action '''
|
''' authentication action '''
|
||||||
|
if request.user.is_authenticated:
|
||||||
|
return redirect('/')
|
||||||
login_form = forms.LoginForm(request.POST)
|
login_form = forms.LoginForm(request.POST)
|
||||||
|
|
||||||
localname = login_form.data['localname']
|
localname = login_form.data['localname']
|
||||||
|
|
Loading…
Reference in New Issue