From cd7820ddd209f92cd87d55845112cf1cee2c14c0 Mon Sep 17 00:00:00 2001
From: billz <billzimmerman@gmail.com>
Date: Thu, 8 Feb 2024 09:41:42 +0100
Subject: [PATCH] Fix get/set admin username

---
 includes/admin.php           | 1 +
 src/RaspAP/Auth/HTTPAuth.php | 1 +
 2 files changed, 2 insertions(+)

diff --git a/includes/admin.php b/includes/admin.php
index 70c29b7c..b3be3c36 100755
--- a/includes/admin.php
+++ b/includes/admin.php
@@ -5,6 +5,7 @@ function DisplayAuthConfig($username)
     $status = new \RaspAP\Messages\StatusMessage;
     $auth = new \RaspAP\Auth\HTTPAuth;
     $config = $auth->getAuthConfig();
+    $username = $config['admin_user'];
     $password = $config['admin_pass'];
 
     if (isset($_POST['UpdateAdminPassword'])) {
diff --git a/src/RaspAP/Auth/HTTPAuth.php b/src/RaspAP/Auth/HTTPAuth.php
index 9751075f..7c31e0f9 100755
--- a/src/RaspAP/Auth/HTTPAuth.php
+++ b/src/RaspAP/Auth/HTTPAuth.php
@@ -96,6 +96,7 @@ class HTTPAuth
             if ($auth_details = fopen(RASPI_CONFIG . '/raspap.auth', 'r')) {
                 $config['admin_user'] = trim(fgets($auth_details));
                 $config['admin_pass'] = trim(fgets($auth_details));
+                $_SESSION['user_id'] = $config['admin_user'];
                 fclose($auth_details);
             }
         }