84 $type, $returnTo =
'', $returnToQuery =
'', $stickHTTPS =
false, $returnToAnchor =
''
87 if ( $type !==
'error' && $config->get( MainConfigNames::RedirectOnLogin ) !==
null ) {
88 $returnTo = $config->get( MainConfigNames::RedirectOnLogin );
90 } elseif ( is_string( $returnToQuery ) ) {
93 if ( $returnToAnchor !==
'' && $returnToAnchor[0] !==
'#' ) {
98 $oldReturnTo = $returnTo;
99 $oldReturnToQuery = $returnToQuery;
100 $this->getHookRunner()->onPostLoginRedirect( $returnTo, $returnToQuery, $type );
101 if ( $returnTo !== $oldReturnTo || $returnToQuery !== $oldReturnToQuery ) {
104 $returnToAnchor =
'';
107 $returnToTitle = Title::newFromText( $returnTo ) ?: Title::newMainPage();
109 if ( $config->get( MainConfigNames::ForceHTTPS )
110 || ( $config->get( MainConfigNames::SecureLogin ) && $stickHTTPS )
112 $options = [
'https' ];
114 } elseif ( $config->get( MainConfigNames::SecureLogin ) && !$stickHTTPS ) {
115 $options = [
'http' ];
122 if ( $type ===
'successredirect' ) {
123 $redirectUrl = $returnToTitle->getFullUrlForRedirect( $returnToQuery, $proto )
125 $this->
getOutput()->redirect( $redirectUrl );
127 $this->
getOutput()->addReturnTo( $returnToTitle, $returnToQuery,
null, $options );