From b8844dcedb0e596c0ba5fb433b4ec4e1e4373f5b Mon Sep 17 00:00:00 2001 From: Tom Mortensen Date: Thu, 1 Feb 2024 14:41:18 -0800 Subject: [PATCH] If no regkey use 'Tools>Registration' as start page --- emhttp/login.php | 3 +++ emhttp/plugins/dynamix/include/.login.php | 6 +++--- emhttp/plugins/dynamix/include/.set-password.php | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/emhttp/login.php b/emhttp/login.php index 9a0d42e7d..9c6bd96f9 100644 --- a/emhttp/login.php +++ b/emhttp/login.php @@ -27,6 +27,9 @@ if ($_SERVER['REQUEST_URI'] == '/logout') { $error = _('Successfully logged out'); } +// If issue with license key redirect to Tools/Registration, otherwise go to start page +$start_page = (!empty(_var($var,'regCheck'))) ? 'Tools/Registration' : _var($var,'START_PAGE','Main'); + $result = exec( "/usr/bin/passwd --status root"); if (($result === false) || (substr($result, 0, 6) !== "root P")) include "$docroot/webGui/include/.set-password.php"; diff --git a/emhttp/plugins/dynamix/include/.login.php b/emhttp/plugins/dynamix/include/.login.php index 88e1f2be3..58e03f789 100644 --- a/emhttp/plugins/dynamix/include/.login.php +++ b/emhttp/plugins/dynamix/include/.login.php @@ -9,8 +9,8 @@ if (!empty($_COOKIE['unraid_'.md5($server_name)])) { // Check if the user is already logged in if ($_SESSION && !empty($_SESSION['unraid_user'])) { - // If so redirect them to the start page - header("Location: /".$var['START_PAGE']); + // Redirect the user to the start page + header("Location: /".$start_page); exit; } } @@ -219,7 +219,7 @@ if (!empty($username) && !empty($password)) { exec("logger -t webGUI -- \"Successful login user {$username} from {$remote_addr}\""); // Redirect the user to the start page - header("Location: /".$var['START_PAGE']); + header("Location: /".$start_page); exit; } catch (Exception $exception) { // Set error message diff --git a/emhttp/plugins/dynamix/include/.set-password.php b/emhttp/plugins/dynamix/include/.set-password.php index 19978ca76..3e3256f46 100644 --- a/emhttp/plugins/dynamix/include/.set-password.php +++ b/emhttp/plugins/dynamix/include/.set-password.php @@ -30,7 +30,8 @@ if (!empty($_POST['password']) && !empty($_POST['confirmPassword'])) { session_regenerate_id(true); session_write_close(); - header("Location: /".$var['START_PAGE']); + // Redirect the user to the start page + header("Location: /".$start_page); exit; }