Add a hook "TempUserCreatedRedirect" which allows an extension to modify the post-save redirect after a temporary user is created. CentralAuth will handle this hook in order to redirect to loginwiki. Loginwiki will redirect back to the page being saved. In LoginHelper::showReturnToPage add an "anchor" parameter to specify the URL fragment to redirect to. This is intended for section editing with a redirect via loginwiki. In AuthManager::autoCreateUser(), just allow any valid username, don't require it to be creatable. Previously a non-creatable username was allowed only with $source=AUTOCREATE_SOURCE_TEMP, but CentralAuth depends on user autocreation from the session during refreshCookies. The session is already validated at this point, so it's not like a user can exploit this to create arbitrary names. Change-Id: I623330dbf5d0573c93ae22f962618d6ddbd126d9
38 lines
1 KiB
PHP
38 lines
1 KiB
PHP
<?php
|
|
|
|
namespace MediaWiki\Hook;
|
|
|
|
use MediaWiki\Session\Session;
|
|
use MediaWiki\User\UserIdentity;
|
|
|
|
/**
|
|
* This is a hook handler interface, see docs/Hooks.md.
|
|
* Use the hook name "TempUserCreatedRedirect" to register handlers implementing this interface.
|
|
*
|
|
* @stable to implement
|
|
* @ingroup Hooks
|
|
*/
|
|
interface TempUserCreatedRedirectHook {
|
|
/**
|
|
* This hook is called after an action causes a temporary user to be
|
|
* created. The handler may modify the redirect URL.
|
|
*
|
|
* @since 1.39
|
|
*
|
|
* @param Session $session
|
|
* @param UserIdentity $user
|
|
* @param string $returnTo The prefixed DB key of the title to redirect to
|
|
* @param string $returnToQuery An extra query part
|
|
* @param string $returnToAnchor Either an empty string or a fragment beginning with "#"
|
|
* @param string &$redirectUrl The URL to redirect to
|
|
* @return bool|null
|
|
*/
|
|
public function onTempUserCreatedRedirect(
|
|
Session $session,
|
|
UserIdentity $user,
|
|
string $returnTo,
|
|
string $returnToQuery,
|
|
string $returnToAnchor,
|
|
&$redirectUrl
|
|
);
|
|
}
|