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

Commit

Permalink
fix(base): improve the way of redirection in login workflow for prede…
Browse files Browse the repository at this point in the history
…fined default page (#8581)

Resolve MON-5149
  • Loading branch information
vhr authored Apr 10, 2020
1 parent a551c13 commit 0d565a9
Showing 1 changed file with 19 additions and 5 deletions.
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

0 comments on commit 0d565a9

Please sign in to comment.