Fixed page_after_login feature - see #5266

skala
Yannick Warnier 13 years ago
parent 8cb94e89d5
commit 72d67dfd1f
  1. 13
      main/inc/lib/redirect.class.php
  2. 8
      main/inc/local.inc.php

@ -35,8 +35,9 @@ class Redirect
/**
* Redirect to the session "request uri" if it exists.
* @param bool Whether the user ha just logged in (in this case, use page_after_login rules)
*/
static function session_request_uri()
static function session_request_uri($logging_in = false)
{
// if (api_is_anonymous())
// {
@ -53,9 +54,13 @@ class Redirect
unset($_SESSION['request_uri']);
if ($url)
{
if (!empty($url)) {
self::navigate($url);
} elseif ($logging_in) {
$pal = api_get_setting('page_after_login');
if (!empty($pal)) {
self::navigate(api_get_path(WEB_PATH).api_get_setting('page_after_login'));
}
}
}
@ -78,4 +83,4 @@ class Redirect
exit;
}
}
}

@ -154,6 +154,8 @@ $gidReset = isset($gidReset) ? $gidReset : '';
// parameters passed via POST
$login = isset($_POST["login"]) ? $_POST["login"] : '';
// register if the user is just logging in, in order to redirect him
$logging_in = false;
/* MAIN CODE */
@ -243,7 +245,7 @@ if (!empty($_SESSION['_user']['user_id']) && ! ($login || $logout)) {
$password = api_get_encrypted_password(trim(stripslashes($password)));
// Check the user's password
if ( ($password == $uData['password'] OR $cas_login) AND (trim($login) == $uData['username'])) {
if ( ($password == $uData['password'] OR $cas_login) AND (trim($login) == $uData['username'])) {
$update_type = UserManager::get_extra_user_data_by_field($uData['user_id'], 'update_type');
$update_type= $update_type['update_type'];
if (!empty($extAuthSource[$update_type]['updateUser']) && file_exists($extAuthSource[$update_type]['updateUser'])) {
@ -279,6 +281,7 @@ if (!empty($_SESSION['_user']['user_id']) && ! ($login || $logout)) {
$_user['status'] = $uData['status'];
Session::write('_user',$_user);
event_login();
$logging_in = true;
} else {
$loginFailed = true;
Session::erase('_uid');
@ -322,6 +325,7 @@ if (!empty($_SESSION['_user']['user_id']) && ! ($login || $logout)) {
Session::write('_user',$_user);
event_login();
$logging_in = true;
}
} else {
$loginFailed = true;
@ -1100,5 +1104,5 @@ if (isset($_cid)) {
Database::query($sql);
}
Redirect::session_request_uri();
Redirect::session_request_uri($logging_in);

Loading…
Cancel
Save