# Confirm that the account was created
$out->setPageTitle( $this->msg( 'accountcreated' ) );
$out->addWikiMsg( 'accountcreatedtext', $u->getName() );
- $out->addReturnTo( $this->getTitle() );
+ $out->addReturnTo( $this->getPageTitle() );
wfRunHooks( 'AddNewAccount', array( $u, false ) );
$u->addNewUserLogEntry( 'create2', $this->mReason );
}
}
# Include checks that will include GlobalBlocking (Bug 38333)
- $permErrors = $this->getTitle()->getUserPermissionsErrors( 'createaccount', $currentUser, true );
+ $permErrors = $this->getPageTitle()->getUserPermissionsErrors( 'createaccount', $currentUser, true );
if ( count( $permErrors ) ) {
throw new PermissionsError( 'createaccount', $permErrors );
}
$u->setRealName( $this->mRealName );
$abortError = '';
- if ( !wfRunHooks( 'AbortNewAccount', array( $u, &$abortError ) ) ) {
+ $abortStatus = null;
+ if ( !wfRunHooks( 'AbortNewAccount', array( $u, &$abortError, &$abortStatus ) ) ) {
// Hook point to add extra creation throttles and blocks
wfDebug( "LoginForm::addNewAccountInternal: a hook blocked creation\n" );
- $abortError = new RawMessage( $abortError );
- $abortError->text();
- return Status::newFatal( $abortError );
+ if ( $abortStatus === null ) {
+ // Report back the old string as a raw message status.
+ // This will report the error back as 'createaccount-hook-aborted'
+ // with the given string as the message.
+ // To return a different error code, return a Status object.
+ $abortError = new Message( 'createaccount-hook-aborted', array( $abortError ) );
+ $abortError->text();
+ return Status::newFatal( $abortError );
+ } else {
+ // For MediaWiki 1.23+ and updated hooks, return the Status object
+ // returned from the hook.
+ return $abortStatus;
+ }
}
// Hook point to check for exempt from account creation throttle
function resetLoginForm( $error ) {
$this->getOutput()->addHTML( Xml::element( 'p', array( 'class' => 'error' ), $error ) );
$reset = new SpecialChangePassword();
- $reset->setContext( $this->getContext() );
+ $derivative = new DerivativeContext( $this->getContext() );
+ $derivative->setTitle( $reset->getPageTitle() );
+ $reset->setContext( $derivative );
$reset->execute( null );
}
global $wgAuth, $wgEmailConfirmToEdit, $wgCookieExpiration;
global $wgSecureLogin, $wgPasswordResetRoutes;
- $titleObj = $this->getTitle();
+ $titleObj = $this->getPageTitle();
$user = $this->getUser();
$out = $this->getOutput();
*/
public static function setLoginToken() {
global $wgRequest;
- // Generate a token directly instead of using $user->editToken()
+ // Generate a token directly instead of using $user->getEditToken()
// because the latter reuses $_SESSION['wsEditToken']
$wgRequest->setSessionData( 'wsLoginToken', MWCryptRand::generateHex( 32 ) );
}
$attr['lang'] = $attr['hreflang'] = $targetLanguage->getHtmlCode();
return Linker::linkKnown(
- $this->getTitle(),
+ $this->getPageTitle(),
htmlspecialchars( $text ),
$attr,
$query