Merge remote-tracking branch 'origin/v3.0'

This commit is contained in:
Adolfo Gómez García 2020-10-16 13:29:18 +02:00
commit 33502140cf
2 changed files with 6 additions and 1 deletions

View File

@ -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,

View File

@ -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