Fixed authentication multihost

This commit is contained in:
Adolfo Gómez García 2020-08-25 13:42:27 +02:00
parent 110f1c23f1
commit f0caabf814
2 changed files with 4 additions and 3 deletions

View File

@ -61,9 +61,8 @@ def checkLogin( # pylint: disable=too-many-branches, too-many-statements
host = request.META.get('HTTP_HOST') or request.META.get('SERVER_NAME') or 'auth_host' # Last one is a placeholder in case we can't locate host name
# Get Authenticators limitation
logger.debug('Host: %s', host)
if GlobalConfig.DISALLOW_GLOBAL_LOGIN.getBool(False) is True:
if tag is None:
if not tag:
try:
Authenticator.objects.get(small_name=host)
tag = host

View File

@ -81,9 +81,11 @@ def udsJs(request: 'HttpRequest') -> str:
tag = request.session.get('tag', None)
if GlobalConfig.DISALLOW_GLOBAL_LOGIN.getBool() is True:
if GlobalConfig.DISALLOW_GLOBAL_LOGIN.getBool():
try:
authenticators = Authenticator.objects.filter(small_name=auth_host)[:]
if not authenticators:
raise Exception() # Needs one auth at least if possible...
except Exception as e:
try:
authenticators = [Authenticator.objects.order_by('priority')[0]]