Skip to content

Commit

Permalink
Fix #11394: No email sent for lost password process
Browse files Browse the repository at this point in the history
When a MantisBT installation is setup without anonymous access enabled
auth_get_current_user_id() will fail, redirecting the user back to the
login screen.

This was due to a problem in user_pref_get() where it was assumed that a
user was logged in. For the lost password recovery step (with no
anonymous login), the lost password recovery step happens without any
user logged in.
  • Loading branch information
davidhicks committed Apr 21, 2010
1 parent 2b20ecf commit 2e73850
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/user_pref_api.php
Expand Up @@ -461,7 +461,9 @@ function user_pref_get( $p_user_id, $p_project_id = ALL_PROJECTS ) {
static $t_vars;
global $g_cache_current_user_pref;

if ( isset( $g_cache_current_user_pref[(int)$p_project_id] ) && auth_get_current_user_id() == $p_user_id ) {
if ( isset( $g_cache_current_user_pref[(int)$p_project_id] ) &&
auth_is_user_authenticated() &&
auth_get_current_user_id() == $p_user_id ) {
return $g_cache_current_user_pref[(int)$p_project_id];
}

Expand Down Expand Up @@ -497,7 +499,7 @@ function user_pref_get( $p_user_id, $p_project_id = ALL_PROJECTS ) {
$t_prefs->$var = $row[$var];
}
}
if ( auth_get_current_user_id() == $p_user_id ) {
if ( auth_is_user_authenticated() && auth_get_current_user_id() == $p_user_id ) {
$g_cache_current_user_pref[ (int)$p_project_id ] = $t_prefs;
}
return $t_prefs;
Expand Down

0 comments on commit 2e73850

Please sign in to comment.