Move the login redirect to check_auth.php

This commit is contained in:
FusionPBX 2021-07-31 22:53:13 -06:00 committed by GitHub
parent c9e44dca4b
commit df3e85dd17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 16 deletions

View File

@ -17,16 +17,17 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2020
Portions created by the Initial Developer are Copyright (C) 2008-2021
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J. Crane <markjcrane@fusionpbx.com>
*/
//include root
include "root.php";
// start the session
//start the session
ini_set("session.cookie_httponly", True);
if (!isset($_SESSION)) { session_start(); }
@ -47,7 +48,7 @@
exit;
}
// if not logged in, clear the session variables
//if not logged in, clear the session variables
//if (strlen($_SESSION["username"]) == 0) {
// session_unset();
// session_destroy();
@ -56,19 +57,8 @@
//adds multiple includes
require_once "resources/require.php";
// if logged in, redirect to login destination
if (isset($_SESSION["username"]) && (strlen($_SESSION["username"]) > 0)) {
if (strlen($_SESSION['login']['destination']['url']) > 0) {
header("Location: ".$_SESSION['login']['destination']['url']);
} elseif (file_exists($_SERVER["PROJECT_ROOT"]."/core/user_settings/user_dashboard.php")) {
header("Location: ".PROJECT_PATH."/core/user_settings/user_dashboard.php");
}
else {
require_once "resources/header.php";
require_once "resources/footer.php";
}
}
else {
//if logged in, redirect to login destination
if (!isset($_SESSION["username"])) {
//use custom index, if present, otherwise use custom login, if present, otherwise use default login
if (file_exists($_SERVER["PROJECT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/index.php")) {
require_once "themes/".$_SESSION['domain']['template']['name']."/index.php";