diff --git a/core.php b/core.php index f52fe39287..82ad8a0c0a 100644 --- a/core.php +++ b/core.php @@ -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' ) ); } diff --git a/core/authentication_api.php b/core/authentication_api.php index 761396b31e..a90a720157 100644 --- a/core/authentication_api.php +++ b/core/authentication_api.php @@ -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; } diff --git a/verify.php b/verify.php index 31d22b5cdc..d9193e1aff 100644 --- a/verify.php +++ b/verify.php @@ -21,6 +21,10 @@ * @author Marcello Scata' ITALY * @link http://www.mantisbt.org */ + + # don't auto-login when trying to verify new user + $g_login_anonymous = false; + /** * MantisBT Core API's */ @@ -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