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

Commit

Permalink
fix(autologin) keep uri parameters. (#8262)
Browse files Browse the repository at this point in the history
  • Loading branch information
loiclau committed Jan 22, 2020
1 parent e57a8c8 commit 3298adc
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions www/include/core/login/processLogin.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@

require_once _CENTREON_PATH_ . 'bootstrap.php';

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

if (isset($_POST["centreon_token"])
|| (isset($_GET["autologin"]) &&
$_GET["autologin"] &&
Expand Down Expand Up @@ -111,17 +113,22 @@

if (!isset($_POST["submit"])) {
$headerRedirection = "./main.php";
$minimize = '';
if (isset($_GET["min"]) && $_GET["min"] == '1') {
$minimize = '&min=1';
}
if (!empty($_GET["p"])) {
$headerRedirection .= "?p=" . $_GET["p"];
} else if (isset($centreon->user->default_page) && $centreon->user->default_page != '') {
unset($_GET["p"]);
foreach ($_GET as $parameter => $value) {
if (!in_array($parameter, AUTOLOGIN_FIELDS)) {
$headerRedirection .= '&' . $parameter . '=' . $value;
}
}
} 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';
}
}
}
header("Location: " . $headerRedirection . $minimize);
header("Location: " . $headerRedirection);
$connect = true;
} else {
$connect = false;
Expand Down

0 comments on commit 3298adc

Please sign in to comment.