diff --git a/actions/xmpp-register b/actions/xmpp-register index 0d402d21d..5662a88f5 100755 --- a/actions/xmpp-register +++ b/actions/xmpp-register @@ -16,4 +16,4 @@ # along with this program. If not, see . # -ejabberdctl register "$1" `hostname` "$2" +ejabberdctl register "$1" `hostname` "$2" || echo "Failed to register XMPP account." diff --git a/actions/xmpp-setup b/actions/xmpp-setup index eb6d4c1ac..fe69291b2 100755 --- a/actions/xmpp-setup +++ b/actions/xmpp-setup @@ -58,5 +58,5 @@ if [ "$xmpp_inband_enable" != "$xmpp_inband_enable_cur" ] ; then else sed -i s/"ip_access: all"/"ip_access: trusted_network"/ /etc/ejabberd/ejabberd.yml fi - ejabberdctl restart + ejabberdctl restart || echo "Failed to restart ejabberd with new configuration." fi diff --git a/plinth/modules/xmpp/xmpp.py b/plinth/modules/xmpp/xmpp.py index a5d413059..4ecd78da2 100644 --- a/plinth/modules/xmpp/xmpp.py +++ b/plinth/modules/xmpp/xmpp.py @@ -127,14 +127,21 @@ def _apply_changes(request, old_status, new_status): return if new_status['inband_enabled']: - messages.success(request, _('Inband registration enabled')) option = 'inband_enable' else: - messages.success(request, _('Inband registration disabled')) option = 'noinband_enable' LOGGER.info('Option - %s', option) - actions.superuser_run('xmpp-setup', [option]) + output = actions.superuser_run('xmpp-setup', [option]) + + if 'Failed' in output: + messages.error(request, + _('Error when configuring XMPP server: %s') % + output) + elif option == 'inband_enable': + messages.success(request, _('Inband registration enabled')) + else: + messages.success(request, _('Inband registration disabled')) class RegisterForm(forms.Form): # pylint: disable-msg=W0232