Implement a custom authenticate middleware to correctly handle already-authenticated players in auto-connect webclient mode. Resolves #1037.

This commit is contained in:
Griatch 2016-09-14 22:32:58 +02:00
parent 86f963fa71
commit 07944918f7
3 changed files with 39 additions and 12 deletions

View file

@ -7,6 +7,7 @@ templates on the fly.
"""
from django.contrib.admin.sites import site
from django.conf import settings
from django.contrib.auth import authenticate
from django.contrib.admin.views.decorators import staff_member_required
from django.shortcuts import render
@ -39,6 +40,8 @@ def _shared_login(request):
# The webclient has previously registered a login to this csession
player = PlayerDB.objects.get(id=sesslogin)
try:
# calls our custom authenticate, in web/utils/backend.py
authenticate(autologin=player)
login(request, player)
except AttributeError:
logger.log_trace()