Skip to content

Commit

Permalink
Fixed autologin when GLPI is installed in a subfolder;
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Jan 5, 2017
1 parent a69a2cc commit 4c4df5b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions autologin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ By default, "Remember me" lasts 7 days (For future, add configuration option)
<compatibility>0.90</compatibility>
<compatibility>9.1</compatibility>
</version>
<version>
<num>2.0.2</num>
<compatibility>0.85</compatibility>
<compatibility>0.90</compatibility>
<compatibility>9.1</compatibility>
</version>
</versions>
<langs>
<lang>en_US</lang>
Expand Down
6 changes: 3 additions & 3 deletions setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function plugin_init_autologin() {
$cookie_path = ini_get('session.cookie_path');

//For logout, remove COOKIE to prevent automatic login on open index page
if (Session::getLoginUserID() && isset($_SERVER['SCRIPT_NAME']) && $_SERVER['SCRIPT_NAME'] === trim($CFG_GLPI['root_doc'], '/') . '/front/logout.php') {
if (Session::getLoginUserID() && isset($_SERVER['SCRIPT_NAME']) && $_SERVER['SCRIPT_NAME'] === rtrim($CFG_GLPI['root_doc'], '/') . '/front/logout.php') {
setcookie($cookie_name, '', time() - 3600, $cookie_path);
return;
}
Expand Down Expand Up @@ -60,7 +60,7 @@ function plugin_init_autologin() {

//Redirect from login to front page if is authenticated

if (Session::getLoginUserID() && isset($_SERVER['SCRIPT_NAME']) && $_SERVER['SCRIPT_NAME'] === trim($CFG_GLPI['root_doc'], '/') . '/index.php') {
if (Session::getLoginUserID() && isset($_SERVER['SCRIPT_NAME']) && $_SERVER['SCRIPT_NAME'] === rtrim($CFG_GLPI['root_doc'], '/') . '/index.php') {
$REDIRECT = "";
if (isset($_POST['redirect']) && (strlen($_POST['redirect']) > 0)) {
$REDIRECT = "?redirect=" . rawurlencode($_POST['redirect']);
Expand All @@ -86,7 +86,7 @@ function plugin_init_autologin() {
function plugin_version_autologin() {
return array(
'name' => __('Auto Login', 'autologin'),
'version' => '2.0.1',
'version' => '2.0.2',
'author' => 'Edgard Lorraine Messias',
'license' => 'GPLv2+',
'homepage' => 'https://github.com/edgardmessias/autologin',
Expand Down

0 comments on commit 4c4df5b

Please sign in to comment.