forked from shaba/openuds
Fixed authentication multihost
This commit is contained in:
parent
110f1c23f1
commit
f0caabf814
@ -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
|
||||
|
@ -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]]
|
||||
|
Loading…
x
Reference in New Issue
Block a user