mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
xmpp: Always use LDAP authentication.
This commit is contained in:
1 parent
cb7c9c26f7
commit
b840875c16
2 files changed
+5
-73
No files matched your search
@@ -86,10 +86,6 @@ def index(request):
|
||||
|
||||
class ConfigureForm(forms.Form): # pylint: disable-msg=W0232
|
||||
"""Configuration form"""
|
||||
ldap_enabled = forms.BooleanField(
|
||||
label=_('Use LDAP for authentication'), required=False,
|
||||
help_text=_('When enabled, only LDAP users will be able to login to \
|
||||
the XMPP service'))
|
||||
inband_enabled = forms.BooleanField(
|
||||
label=_('Allow In-Band Registration'), required=False,
|
||||
help_text=_('When enabled, anyone who can reach this server will be \
|
||||
@@ -120,12 +116,9 @@ def configure(request):
|
||||
|
||||
def get_status():
|
||||
"""Return the current status"""
|
||||
output = actions.run('xmpp', ['is-ldap-enabled'])
|
||||
ldap_enabled = 'True' in output.split()
|
||||
output = actions.run('xmpp', ['is-inband-enabled'])
|
||||
inband_enabled = 'True' in output.split()
|
||||
return {'ldap_enabled': ldap_enabled,
|
||||
'inband_enabled': inband_enabled}
|
||||
return {'inband_enabled': inband_enabled}
|
||||
|
||||
|
||||
def _apply_changes(request, old_status, new_status):
|
||||
@@ -134,25 +127,6 @@ def _apply_changes(request, old_status, new_status):
|
||||
|
||||
setting_changed = False
|
||||
|
||||
if not old_status['ldap_enabled'] and new_status['ldap_enabled']:
|
||||
setting_changed = True
|
||||
output = actions.superuser_run('xmpp', ['enable-ldap'])
|
||||
if 'Failed' in output:
|
||||
messages.error(request,
|
||||
_('Error when configuring XMPP server: %s') %
|
||||
output)
|
||||
else:
|
||||
messages.success(request, _('LDAP authentication enabled'))
|
||||
elif old_status['ldap_enabled'] and not new_status['ldap_enabled']:
|
||||
setting_changed = True
|
||||
output = actions.superuser_run('xmpp', ['disable-ldap'])
|
||||
if 'Failed' in output:
|
||||
messages.error(request,
|
||||
_('Error when configuring XMPP server: %s') %
|
||||
output)
|
||||
else:
|
||||
messages.success(request, _('LDAP authentication disabled'))
|
||||
|
||||
if not old_status['inband_enabled'] and new_status['inband_enabled']:
|
||||
setting_changed = True
|
||||
output = actions.superuser_run('xmpp', ['enable-inband'])
|
||||
|
||||
Reference in new issue
Block a user