diff --git a/core/authentication_api.php b/core/authentication_api.php index 620ae76e6f..c8385cd6af 100644 --- a/core/authentication_api.php +++ b/core/authentication_api.php @@ -753,7 +753,7 @@ function auth_set_tokens( $p_user_id ) { } /** - * Check for authentication tokens, and display re-authentication page if needed. + * Check for authentication tokens, and redirect to login page for re-authentication. * Currently, if using BASIC or HTTP authentication methods, or if logged in anonymously, * this function will always "authenticate" the user (do nothing). * @@ -781,101 +781,20 @@ function auth_reauthenticate() { return true; } - return auth_reauthenticate_page( $t_user_id, $t_username ); - } -} - -/** - * Generate the intermediate authentication page. - * @param integer $p_user_id User ID. - * @param string $p_username Username. - * @return boolean - * @access public - */ -function auth_reauthenticate_page( $p_user_id, $p_username ) { - $t_error = false; + $t_request_uri = string_url( $_SERVER['REQUEST_URI'] ); - if( true == gpc_get_bool( '_authenticate' ) ) { - $f_password = gpc_get_string( 'password', '' ); + $t_query_params = http_build_query( + array( + 'reauthenticate' => 1, + 'username' => $t_username, + 'return' => $t_request_uri, + ), + '', '&' + ); - if( auth_attempt_login( $p_username, $f_password ) ) { - auth_set_tokens( $p_user_id ); - return true; - } else { - $t_error = true; - } + # redirect to login page + print_header_redirect( 'login_page.php?' . $t_query_params ); } - - layout_page_header(); - - layout_page_begin(); - - ?> -
-
-'; - echo '

' . lang_get( 'reauthenticate_message' ) . ' ' . lang_get( 'login_error' ) . '

'; - echo '
'; - } -?> - -
-
-
-
-

- - -

-
- -
-
-
- - - -
- - - - - - - - - -
- - - -
- - - -
-
-
-
-
- -
-
-
-
-
- - -