1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-10 01:17:59 +03:00

Added possible support for personalized logout url on login form

This commit is contained in:
Adolfo Gómez García 2017-04-19 13:24:32 +02:00
parent 2daafa2c4a
commit 4fbbfb8d10
3 changed files with 13 additions and 1 deletions

View File

@ -56,6 +56,7 @@ class Authenticators(ModelHandler):
table_title = _('Current authenticators')
table_fields = [
{'numeric_id': {'title': _('Id'), 'visible': True}},
{'name': {'title': _('Name'), 'visible': True, 'type': 'iconType'}},
{'comments': {'title': _('Comments')}},
{'priority': {'title': _('Priority'), 'type': 'numeric', 'width': '5em'}},
@ -88,6 +89,7 @@ class Authenticators(ModelHandler):
def item_as_dict(self, auth):
type_ = auth.getType()
return {
'numeric_id': auth.id,
'id': auth.uuid,
'name': auth.name,
'tags': [tag.tag for tag in auth.tags.all()],

View File

@ -65,6 +65,8 @@ class LoginForm(forms.Form):
authenticator = forms.ChoiceField(label=_('Authenticator'), choices=(), widget=CustomSelect(), required=False)
standard = forms.CharField(widget=forms.HiddenInput(), required=False)
nonStandard = forms.CharField(widget=forms.HiddenInput(), required=False)
logouturl = forms.CharField(widget=forms.HiddenInput(), required=False)
def __init__(self, *args, **kwargs):
# If an specified login is passed in, retrieve it & remove it from kwargs dict

View File

@ -123,6 +123,11 @@ def login(request, tag=None):
webLogin(request, response, user, form.cleaned_data['password'])
# Add the "java supported" flag to session
request.session['OS'] = os
if form.cleaned_data['logouturl'] != '':
logger.debug('The logoout url will be {}'.format(form.cleaned_data['logouturl']))
request.session['logouturl'] = form.cleaned_data['logouturl']
else:
logger.debug('EL LOGOUT ESTA VACIOOOOOOOOO')
authLogLogin(request, authenticator, user.name)
return response
else:
@ -162,4 +167,7 @@ def customAuth(request, idAuth):
@webLoginRequired(admin=False)
def logout(request):
authLogLogout(request)
return webLogout(request, request.user.logout())
logoutUrl = request.user.logout()
if logoutUrl is None:
logoutUrl = request.session.get('logouturl', None)
return webLogout(request, logoutUrl)