diff --git a/server/src/uds/core/auths/auth.py b/server/src/uds/core/auths/auth.py index 55546e8fb..d72936457 100644 --- a/server/src/uds/core/auths/auth.py +++ b/server/src/uds/core/auths/auth.py @@ -276,6 +276,9 @@ def authenticate( if res is False: return None + if isinstance(res, str): + return res # type: ignore # note: temporal fix on 3.5 for possible redirect on failed login + logger.debug('Groups manager: %s', gm) # If do not have any valid group diff --git a/server/src/uds/web/util/authentication.py b/server/src/uds/web/util/authentication.py index 73e63c541..b74c0a528 100644 --- a/server/src/uds/web/util/authentication.py +++ b/server/src/uds/web/util/authentication.py @@ -127,6 +127,9 @@ def checkLogin( # pylint: disable=too-many-branches, too-many-statements user = authenticate(userName, password, authenticator) logger.debug('User: %s', user) + if isinstance(user, str): + return (user, user) + if user is None: logger.debug("Invalid user %s (access denied)", userName) cache.put(cacheKey, tries + 1, GlobalConfig.LOGIN_BLOCK.getInt()) diff --git a/server/src/uds/web/views/modern.py b/server/src/uds/web/views/modern.py index 8f49adb27..f163602f3 100644 --- a/server/src/uds/web/views/modern.py +++ b/server/src/uds/web/views/modern.py @@ -74,6 +74,8 @@ def login( request.session['restricted'] = False # Access is from login form = LoginForm(request.POST, tag=tag) user, data = checkLogin(request, form, tag) + if isinstance(user, str): + return HttpResponseRedirect(user) if user: response = HttpResponseRedirect(reverse('page.index')) # save tag, weblogin will clear session