Extension:CentralAuth/Hooks/CentralAuthPostLoginRedirect
CentralAuthPostLoginRedirect | |
---|---|
Available from version 1.22 (Gerrit change 73449) Allows extensions to modify the redirect location after the user has finished logging in to their account. |
|
Define function: | public static function onCentralAuthPostLoginRedirect( string &$returnTo, string &$returnToQuery, bool $stickHttps, string $type, string &$injectHtml ) { ... }
|
Attach hook: | $wgHooks['CentralAuthPostLoginRedirect'][] = 'MyExtensionHooks::onCentralAuthPostLoginRedirect';
|
Called from: | File(s): CentralAuth / includes/specials/SpecialCentralLogin.php Function(s): doLoginComplete |
For more information about attaching hooks, see Manual:Hooks .
For examples of other extensions using this hook, see Category:CentralAuthPostLoginRedirect extensions.
Login and signup links will usually set the &returnto=...
and &returntoquery=...
URL parameters so that after login / signup the user can be returned to where they were. These values are provided to this hook before redirecting, allowing extensions to change the return _target to a particular welcome page or to provide an extra query string parameter.
Extensions that change the return _target should pass the original $returnTo
and $returnToQuery
values to the _target page, which should redirect the user to the original return _target once it does whatever it needs to do. This is necessary for compatibility with other extensions depending on the return _target for their functionality, e.g. OAuth. Alternatively, you might only change the return _target after detecting a custom URL parameter provided by your extension's own workflow.
Extensions that add HTML to the "success" form page after login or account creation by hooking UserLoginComplete or BeforeWelcomeCreation will probably need to hook this to achieve similar results if CentralAuth is in use.
If there is no returnto parameter to the login or create account form, and no extension changes the link, CentralAuth redirects to the default page of the wiki.
Parameters
edit&$returnTo
: A modifiablestring
representing the page title to redirect to. The CentralAuth extension sets this to the returnto query string parameter that was passed to the login or create account form (if any); extensions can replace it with another page.&$returnToQuery
: A modifiablestring
representing the URL parameters to use for the returning query. The extension sets this to thereturntoquery
query string parameter that was passed to the login or create account form (if any); extensions can replace or add to it.$stickHttps
: (deprecated in 1.42) Unused. Prior to MW 1.42: Abool
representing whether or not the redirect link will continue to use HTTPS. See$wgSecureLogin
.$type
:signup
during signup, empty string otherwise.&$injectHtml
: (deprecated in 1.42) Unused. Prior to MW 1.42: A modifiablestring
representing the HTML to show on the login success page. Set to empty string to skip the success page and redirect to$returnTo
immediately.