Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix regression of issue #10930 in commit 0085bcd
The initial fixes for #10930 and issue #11031 did not take into account
the usage of auth_is_user_authenticated() in multiple locations during
the core bootstrap routines.  By defining and looking for a global flag,
rather than an argument to the function, we fix both the problems and
the regression.
  • Loading branch information
amyreese committed Dec 17, 2009
1 parent dc27985 commit 429448e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions core.php
Expand Up @@ -222,6 +222,10 @@ function __autoload( $className ) {
config_set_global( 'default_timezone', date_default_timezone_get(), true );
}

if ( !isset( $g_login_anonymous ) ) {
$g_login_anonymous = true;
}

if( auth_is_user_authenticated() ) {
date_default_timezone_set( user_pref_get_pref( auth_get_current_user_id(), 'timezone' ) );
}
Expand Down
6 changes: 3 additions & 3 deletions core/authentication_api.php
Expand Up @@ -89,12 +89,12 @@ function auth_ensure_user_authenticated( $p_return_page = '' ) {
* @return bool
* @access public
*/
function auth_is_user_authenticated( $p_login_anonymous=true ) {
global $g_cache_cookie_valid;
function auth_is_user_authenticated() {
global $g_cache_cookie_valid, $g_login_anonymous;
if( $g_cache_cookie_valid == true ) {
return $g_cache_cookie_valid;
}
$g_cache_cookie_valid = auth_is_cookie_valid( auth_get_current_user_cookie( $p_login_anonymous ) );
$g_cache_cookie_valid = auth_is_cookie_valid( auth_get_current_user_cookie( $g_login_anonymous ) );
return $g_cache_cookie_valid;
}

Expand Down
6 changes: 5 additions & 1 deletion verify.php
Expand Up @@ -21,6 +21,10 @@
* @author Marcello Scata' <marcelloscata at users.sourceforge.net> ITALY
* @link http://www.mantisbt.org
*/

# don't auto-login when trying to verify new user
$g_login_anonymous = false;

/**
* MantisBT Core API's
*/
Expand All @@ -37,7 +41,7 @@
$f_confirm_hash = gpc_get_string('confirm_hash');

# force logout on the current user if already authenticated
if( auth_is_user_authenticated( false ) ) {
if( auth_is_user_authenticated() ) {
auth_logout();

# reload the page after logout
Expand Down

0 comments on commit 429448e

Please sign in to comment.