mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-29 19:40:32 +00:00
Merge pull request #664 from mouse-reeve/login-csrf
Fixes csrf failure logging on from multiple tabs
This commit is contained in:
commit
b2779cc6bf
1 changed files with 4 additions and 0 deletions
|
@ -6,6 +6,7 @@ from django.shortcuts import get_object_or_404, redirect
|
|||
from django.template.response import TemplateResponse
|
||||
from django.utils import timezone
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from django.views import View
|
||||
|
||||
from bookwyrm import forms, models
|
||||
|
@ -13,6 +14,7 @@ from bookwyrm.settings import DOMAIN
|
|||
|
||||
|
||||
# pylint: disable= no-self-use
|
||||
@method_decorator(csrf_exempt, name='dispatch')
|
||||
class Login(View):
|
||||
''' authenticate an existing user '''
|
||||
def get(self, request):
|
||||
|
@ -28,6 +30,8 @@ class Login(View):
|
|||
|
||||
def post(self, request):
|
||||
''' authentication action '''
|
||||
if request.user.is_authenticated:
|
||||
return redirect('/')
|
||||
login_form = forms.LoginForm(request.POST)
|
||||
|
||||
localname = login_form.data['localname']
|
||||
|
|
Loading…
Reference in a new issue