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:
parent
2daafa2c4a
commit
4fbbfb8d10
@ -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()],
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user