34 AuthManager::ACTION_CREATE,
35 AuthManager::ACTION_CREATE_CONTINUE
39 'authform-newtoken' =>
'nocookiesfornew',
40 'authform-notoken' =>
'sessionfailure',
41 'authform-wrongtoken' =>
'sessionfailure',
48 parent::__construct(
'CreateAccount',
'createaccount' );
58 parent::checkPermissions();
61 $status = $this->
getAuthManager()->checkAccountCreatePermissions( $user );
62 if ( !$status->isGood() ) {
63 throw new ErrorPageError(
'createacct-error', $status->getMessage() );
72 return AuthManager::ACTION_CREATE;
76 return $this->
msg(
'createaccount' )->text();
92 $user = $this->targetUser ?: $this->
getUser();
95 # Only save preferences if the user is not creating an account for someone else.
96 if ( !$this->proxyAccountCreation ) {
102 $this->
mainLoginForm( [ ], $session->getProvider()->whyNoSession() );
114 $out->setPageTitle( $this->
msg( $byEmail ?
'accmailtitle' :
'accountcreated' ) );
117 $out->addWikiMsg(
'accmailtext', $user->getName(), $user->getEmail() );
119 $out->addWikiMsg(
'accountcreatedtext', $user->getName() );
122 $rt = Title::newFromText( $this->mReturnTo );
124 ( $rt && !$rt->isExternal() ) ? $rt : $this->
getPageTitle(),
133 # Run any hooks; display injected HTML
135 $welcome_creation_msg =
'welcomecreation-msg';
136 $this->
getHookRunner()->onUserLoginComplete( $user, $injected_html, $direct );
143 $this->
getHookRunner()->onBeforeWelcomeCreation( $welcome_creation_msg, $injected_html );
147 $welcome_creation_msg, $injected_html, $extraMessages );
151 return $this->
getRequest()->getSession()->getToken(
'',
'createaccount' );
155 return $this->
getRequest()->getSession()->resetToken(
'createaccount' );
159 return 'wpCreateaccountToken';
167 LoggerFactory::getInstance(
'authevents' )->info(
'Account creation attempt', [
168 'event' =>
'accountcreation',
170 'status' => strval( $status ),
wfCgiToArray( $query)
This is the logical opposite of wfArrayToCgi(): it accepts a query string as its argument and returns...
string $subPage
Subpage of the special page.
getRequest()
Get the WebRequest being used for this instance.
An error page which can definitely be safely rendered using the OutputPage.
Holds shared logic for login and account creation pages.
mainLoginForm(array $requests, $msg='', $msgtype='error')
showSuccessPage( $type, $title, $msgname, $injected_html, $extraMessages)
Show the success page.
hasSessionCookie()
Check if a session cookie is present.
Implements Special:CreateAccount.
getTokenName()
Returns the name of the CSRF token (under which it should be found in the POST or GET data).
successfulAction( $direct=false, $extraMessages=null)
Run any hooks registered for logins, then display a message welcoming the user.
getToken()
Returns the CSRF token.
logAuthResult( $success, $status=null)
Logs to the authmanager-stats channel.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
doesWrites()
Indicates whether this special page may perform database writes.
__construct(AuthManager $authManager)
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
getDescription()
Returns the name that goes in the <h1> in the special page itself, and also the name that will be l...
getDefaultAction( $subPage)
Get the default action for this special page, if none is given via URL/POST data.
getName()
Get the name of this Special Page.
getOutput()
Get the OutputPage being used for this instance.
getUser()
Shortcut to get the User executing this instance.
AuthManager null $authManager
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
setAuthManager(AuthManager $authManager)
Set the injected AuthManager from the special page constructor.
getPageTitle( $subpage=false)
Get a self-referential title object.