From b7dab27758066b4710877ffd5a4b9dd4e06ae1d7 Mon Sep 17 00:00:00 2001
From: Bob Mottram <bob@freedombone.net>
Date: Sun, 26 Aug 2018 20:12:40 +0100
Subject: [PATCH] Changing admin password changes the image password

---
 src/freedombone-installer | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/freedombone-installer b/src/freedombone-installer
index bd96c6f24..8ce8a817e 100755
--- a/src/freedombone-installer
+++ b/src/freedombone-installer
@@ -38,6 +38,9 @@ INSTALL_STATE_RUNNING_COMMAND=2
 INSTALL_STATE_COMMAND_FAIL=3
 INSTALL_STATE_COMMAND_SUCCESS=4
 
+# file containing new password
+IMAGE_PASSWORD_FILE=/root/login.txt
+
 install_state=$INSTALL_STATE_FIRST_BOOT
 
 CONFIGURATION_FILE="/root/${PROJECT_NAME}.cfg"
@@ -495,7 +498,7 @@ function web_admin_setup_login {
     # if initial setup has not yet happened then create
     # a password file
     if ! grep -q 'install_final' "$COMPLETION_FILE"; then
-        echo -n "$webadmin_password" > /root/login.txt
+        echo -n "$webadmin_password" > ${IMAGE_PASSWORD_FILE}
     fi
 
     echo -n "$INSTALL_STATE_WEBADMIN_PASSWORD_CTEATED" > "$install_state_file"
@@ -1322,6 +1325,7 @@ function webadmin_change_password {
                             sed -i "/${curr_username}:/d" /etc/nginx/.webadminpasswd
                         fi
                         echo -n "$new_password" | htpasswd -i -s -c /etc/nginx/.webadminpasswd "$curr_username"
+                        echo -n "$new_password" > ${IMAGE_PASSWORD_FILE}
                     fi
 
                     # change the login for the user
-- 
GitLab