From d840066468da0a127367be00a45462953364ec42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Fri, 16 Oct 2020 13:28:20 +0200 Subject: [PATCH] Added config variable to allow some more modifications --- server/src/uds/web/util/configjs.py | 3 ++- server/src/uds/web/views/modern.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/server/src/uds/web/util/configjs.py b/server/src/uds/web/util/configjs.py index 21b711a2c..9247741e7 100644 --- a/server/src/uds/web/util/configjs.py +++ b/server/src/uds/web/util/configjs.py @@ -84,7 +84,7 @@ def udsJs(request: 'HttpRequest') -> str: if GlobalConfig.DISALLOW_GLOBAL_LOGIN.getBool(): try: # Get authenticators with auth_host or tag. If tag is None, auth_host, if exists - # tag, later will remove "auth_host" if exists + # tag, later will remove "auth_host" authenticators = Authenticator.objects.filter(small_name__in=[auth_host, tag])[:] except Exception as e: authenticators = [] @@ -121,6 +121,7 @@ def udsJs(request: 'HttpRequest') -> str: 'language': get_language(), 'available_languages': [{'id': k, 'name': gettext(v)} for k, v in settings.LANGUAGES], 'authenticators': [getAuthInfo(auth) for auth in authenticators if auth.getType()], + 'tag': tag, 'os': request.os['OS'], 'csrf_field': CSRF_FIELD, 'csrf': csrf_token, diff --git a/server/src/uds/web/views/modern.py b/server/src/uds/web/views/modern.py index 0186c28c2..2ed05fe86 100644 --- a/server/src/uds/web/views/modern.py +++ b/server/src/uds/web/views/modern.py @@ -68,7 +68,11 @@ def login(request: HttpRequest, tag: typing.Optional[str] = None) -> HttpRespons user, data = checkLogin(request, form, tag) if user: response = HttpResponseRedirect(reverse('page.index')) + # save tag, weblogin will clear session + tag = request.session.get('tag') auth.webLogin(request, response, user, data) # data is user password here + # And restore tag + request.session['tag'] = tag else: # If error is numeric, redirect... # Error, set error on session for process for js