mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-06-03 10:50:20 +00:00
Bug fixes:
Check if ejabberd is installed when running actions triggered by signals. Encode LDAP passwords as bytes.
This commit is contained in:
parent
97220b89f3
commit
d144f6634a
13
actions/xmpp
13
actions/xmpp
@ -24,6 +24,7 @@ Configuration helper for the ejabberd service
|
||||
import argparse
|
||||
import subprocess
|
||||
import os
|
||||
import shutil
|
||||
import socket
|
||||
import re
|
||||
import yaml
|
||||
@ -140,6 +141,10 @@ def subcommand_disable(_):
|
||||
|
||||
def subcommand_pre_change_hostname(arguments):
|
||||
"""Prepare ejabberd for hostname change"""
|
||||
if not shutil.which('ejabberdctl'):
|
||||
print('ejabberdctl not found. Is ejabberd installed?')
|
||||
return
|
||||
|
||||
old_hostname = arguments.old_hostname
|
||||
new_hostname = arguments.new_hostname
|
||||
|
||||
@ -156,6 +161,10 @@ def subcommand_pre_change_hostname(arguments):
|
||||
|
||||
def subcommand_change_hostname(arguments):
|
||||
"""Update ejabberd and jwchat with new hostname"""
|
||||
if not shutil.which('ejabberdctl'):
|
||||
print('ejabberdctl not found. Is ejabberd installed?')
|
||||
return
|
||||
|
||||
action_utils.service_stop('ejabberd')
|
||||
subprocess.call(['pkill', '-u', 'ejabberd'])
|
||||
|
||||
@ -182,6 +191,10 @@ def subcommand_change_hostname(arguments):
|
||||
|
||||
def subcommand_change_domainname(arguments):
|
||||
"""Update ejabberd and jwchat with new domainname"""
|
||||
if not shutil.which('ejabberdctl'):
|
||||
print('ejabberdctl not found. Is ejabberd installed?')
|
||||
return
|
||||
|
||||
domainname = arguments.domainname
|
||||
if not domainname:
|
||||
# If new domainname is blank, use hostname instead.
|
||||
|
||||
@ -69,7 +69,7 @@ than 63 characters in length.'),
|
||||
actions.superuser_run(
|
||||
'create-ldap-user',
|
||||
[user.get_username()],
|
||||
input=self.cleaned_data['password'])
|
||||
input=self.cleaned_data['password'].encode())
|
||||
except ActionError:
|
||||
messages.error(self.request,
|
||||
_('Creating LDAP user failed.'))
|
||||
|
||||
@ -63,7 +63,7 @@ class CreateUserForm(UserCreationForm):
|
||||
actions.superuser_run(
|
||||
'create-ldap-user',
|
||||
[user.get_username()],
|
||||
input=self.cleaned_data['password1'])
|
||||
input=self.cleaned_data['password1'].encode())
|
||||
except ActionError:
|
||||
messages.error(self.request,
|
||||
_('Creating LDAP user failed.'))
|
||||
@ -159,7 +159,7 @@ class UserChangePasswordForm(SetPasswordForm):
|
||||
actions.superuser_run(
|
||||
'change-ldap-user-password',
|
||||
[user.get_username()],
|
||||
input=self.cleaned_data['new_password1'])
|
||||
input=self.cleaned_data['new_password1'].encode())
|
||||
except ActionError:
|
||||
messages.error(
|
||||
self.request,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user