Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

fix(base): improve the way of redirection in login workflow for predefined default page #8581

Merged
merged 1 commit into from
Apr 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions www/include/core/login/processLogin.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

/*
* Copyright 2005-2019 Centreon
* Copyright 2005-2020 Centreon
* Centreon is developed by : Julien Mathis and Romain Le Merlus under
* GPL Licence 2.0.
*
Expand Down Expand Up @@ -37,7 +38,8 @@

const AUTOLOGIN_FIELDS = array('autologin' , 'useralias', 'token');

if (isset($_POST["centreon_token"])
if (
isset($_POST["centreon_token"])
|| (isset($_GET["autologin"]) && $_GET["autologin"]
&& isset($generalOptions["enable_autologin"])
&& $generalOptions["enable_autologin"])
Expand Down Expand Up @@ -122,9 +124,21 @@
}
}
} elseif (isset($centreon->user->default_page) && $centreon->user->default_page != '') {
$headerRedirection .= "?p=" . $centreon->user->default_page;
if (isset($_GET["min"]) && $_GET["min"] == '1') {
$headerRedirection .= '&min=1';
// get more details about the default page
$stmt = $pearDB->prepare(
"SELECT topology_url, is_react FROM topology WHERE topology_page = ? LIMIT 0, 1"
);
$pearDB->execute($stmt, [$centreon->user->default_page]);

if ($stmt->rowCount() && ($topologyData = $stmt->fetch()) && $topologyData['is_react']) {
// redirect to the react path
$headerRedirection = '.' . $topologyData['topology_url'];
} else {
$headerRedirection .= "?p=" . $centreon->user->default_page;

if (isset($_GET["min"]) && $_GET["min"] == '1') {
$headerRedirection .= '&min=1';
}
}
}
}
Expand Down