From e60259391affad929d484b734e75496c8b2cf37c Mon Sep 17 00:00:00 2001
From: Bob Mottram <bob@freedombone.net>
Date: Thu, 5 Jul 2018 15:07:10 +0100
Subject: [PATCH] Ensure that notification user does not already exist

---
 src/freedombone-notification | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/freedombone-notification b/src/freedombone-notification
index b80569d21..9aeb5cb4b 100755
--- a/src/freedombone-notification
+++ b/src/freedombone-notification
@@ -83,9 +83,10 @@ fi
 
 if [ -d /etc/prosody ]; then
     notification_user_password=$(openssl rand -base64 32 | tr -dc A-Za-z0-9 | head -c 30 ; echo -n '')
+    prosodyctl deluser "notification@$HOSTNAME" 2> /dev/null
     if prosodyctl register "notification" "$HOSTNAME" "$notification_user_password" 2> /dev/null; then
         curl http://localhost:5280/msg/user -u "notification@$HOSTNAME:$notification_user_password" -H "Content-Type: text/plain" -d "$MESSAGE" 2> /dev/null
-        prosodyctl deluser "notification@$HOSTNAME" 2> /dev/nul
+        prosodyctl deluser "notification@$HOSTNAME" 2> /dev/null
     fi
 fi
 
-- 
GitLab