mirror of https://github.com/itflow-org/itflow
Fix to properly redirect to the setup page if config_enable_setup is not set or is 1
This commit is contained in:
parent
d8803aaac2
commit
416a8d9a94
25
index.php
25
index.php
|
|
@ -1,28 +1,37 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
// Check if the app is set up
|
||||||
// App setup is complete?
|
|
||||||
if (file_exists("config.php")) {
|
if (file_exists("config.php")) {
|
||||||
require_once "config.php";
|
require_once "config.php";
|
||||||
|
|
||||||
|
// Check if setup is enabled (not completed)
|
||||||
|
if (!isset($config_enable_setup) || $config_enable_setup == 1) {
|
||||||
|
header("Location: /setup");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start the session
|
||||||
require_once "includes/session_init.php";
|
require_once "includes/session_init.php";
|
||||||
|
|
||||||
// If they are an app user, send them to their start page
|
// If user is an agent
|
||||||
if (isset($_SESSION['logged'])) {
|
if (isset($_SESSION['logged'])) {
|
||||||
require_once "includes/load_global_settings.php";
|
require_once "includes/load_global_settings.php";
|
||||||
header("Location: /agent/$config_start_page");
|
header("Location: /agent/$config_start_page");
|
||||||
|
exit();
|
||||||
|
|
||||||
// If they're a client, send them to the client area
|
// If user is a client
|
||||||
} elseif (isset($_SESSION['client_logged_in'])) {
|
} elseif (isset($_SESSION['client_logged_in'])) {
|
||||||
header("Location: /client/");
|
header("Location: /client/");
|
||||||
|
exit();
|
||||||
|
|
||||||
// Else, require login
|
// Not logged in
|
||||||
} else {
|
} else {
|
||||||
header("Location: /login.php");
|
header("Location: /login.php");
|
||||||
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Installation needs to be completed
|
|
||||||
} else {
|
} else {
|
||||||
header("Location: /setup");
|
// If config.php doesn't exist, redirect to setup
|
||||||
|
header("Location: /setup");
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
12
login.php
12
login.php
|
|
@ -3,12 +3,22 @@
|
||||||
// Enforce a Content Security Policy for security against cross-site scripting
|
// Enforce a Content Security Policy for security against cross-site scripting
|
||||||
header("Content-Security-Policy: default-src 'self'");
|
header("Content-Security-Policy: default-src 'self'");
|
||||||
|
|
||||||
|
// Check if the config.php file exists
|
||||||
if (!file_exists('config.php')) {
|
if (!file_exists('config.php')) {
|
||||||
header("Location: /setup"); //must use header instead of redirect as functions isnt included yet.
|
// Redirect to the setup page if config.php doesn't exist
|
||||||
|
header("Location: /setup"); // Must use header as functions aren't included yet
|
||||||
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once "config.php";
|
require_once "config.php";
|
||||||
|
|
||||||
|
// Check if setup mode is enabled or the variable is missing
|
||||||
|
if (!isset($config_enable_setup) || $config_enable_setup == 1) {
|
||||||
|
// Redirect to the setup page
|
||||||
|
header("Location: /setup");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
// Set Timezone
|
// Set Timezone
|
||||||
require_once "includes/inc_set_timezone.php";
|
require_once "includes/inc_set_timezone.php";
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue