81 $type, $returnTo =
'', $returnToQuery =
'', $stickHTTPS =
false, $returnToAnchor =
''
84 if ( $type !==
'error' && $config->get( MainConfigNames::RedirectOnLogin ) !==
null ) {
85 $returnTo = $config->get( MainConfigNames::RedirectOnLogin );
87 } elseif ( is_string( $returnToQuery ) ) {
90 if ( $returnToAnchor !==
'' && $returnToAnchor[0] !==
'#' ) {
95 $oldReturnTo = $returnTo;
96 $oldReturnToQuery = $returnToQuery;
97 $this->getHookRunner()->onPostLoginRedirect( $returnTo, $returnToQuery, $type );
98 if ( $returnTo !== $oldReturnTo || $returnToQuery !== $oldReturnToQuery ) {
101 $returnToAnchor =
'';
104 $returnToTitle = Title::newFromText( $returnTo ) ?: Title::newMainPage();
106 if ( $config->get( MainConfigNames::ForceHTTPS )
107 || ( $config->get( MainConfigNames::SecureLogin ) && $stickHTTPS )
109 $options = [
'https' ];
111 } elseif ( $config->get( MainConfigNames::SecureLogin ) && !$stickHTTPS ) {
112 $options = [
'http' ];
119 if ( $type ===
'successredirect' ) {
120 $redirectUrl = $returnToTitle->getFullUrlForRedirect( $returnToQuery, $proto )
122 $this->
getOutput()->redirect( $redirectUrl );
124 $this->
getOutput()->addReturnTo( $returnToTitle, $returnToQuery,
null, $options );