29 AuthManager::ACTION_CREATE,
30 AuthManager::ACTION_CREATE_CONTINUE
35 'authform-newtoken' =>
'nocookiesfornew',
36 'authform-notoken' =>
'sessionfailure',
37 'authform-wrongtoken' =>
'sessionfailure',
49 parent::__construct(
'CreateAccount',
'createaccount' );
52 $this->formatterFactory = $formatterFactory;
53 $this->identityUtils = $identityUtils;
62 parent::checkPermissions();
67 $status = $this->mPosted ?
68 $authManager->authorizeCreateAccount( $performer ) :
69 $authManager->probablyCanCreateAccount( $performer );
71 if ( !$status->isGood() ) {
72 $formatter = $this->formatterFactory->getStatusFormatter( $this->
getContext() );
74 foreach ( $status->getMessages() as $message ) {
78 false, $performer->getUser(),
83 $formatter->getMessage( $status )
95 return AuthManager::ACTION_CREATE;
100 return $this->
msg(
'createaccount' );
117 $user = $this->targetUser ?: $this->
getUser();
121 # Only save preferences if the user is not creating an account for someone else.
122 if ( !$this->proxyAccountCreation ) {
131 $out->setPageTitleMsg( $this->
msg( $byEmail ?
'accmailtitle' :
'accountcreated' ) );
134 $out->addWikiMsg(
'accmailtext', $user->getName(), $user->getEmail() );
136 $out->addWikiMsg(
'accountcreatedtext', $user->getName() );
139 $rt = Title::newFromText( $this->mReturnTo );
141 ( $rt && !$rt->isExternal() ) ? $rt : $this->
getPageTitle(),
146 $this->
getHookRunner()->onUserLoginComplete( $user, $injected_html, $direct );
151 # Run any hooks; display injected HTML
152 $welcome_creation_msg =
'welcomecreation-msg';
158 $this->
getHookRunner()->onBeforeWelcomeCreation( $welcome_creation_msg, $injected_html );
163 $welcome_creation_msg, $injected_html, $extraMessages );
168 return $this->
getRequest()->getSession()->getToken(
'',
'createaccount' );
172 $this->
getRequest()->getSession()->resetToken(
'createaccount' );
177 return 'wpCreateaccountToken';
187 LoggerFactory::getInstance(
'authevents' )->info(
'Account creation attempt', [
188 'event' =>
'accountcreation',
190 'accountType' => $this->identityUtils->getShortUserTypeInternal( $performer ),
191 'status' => strval( $status )
192 ] + RequestContext::getMain()->
getRequest()->getSecurityLogContext( $performer ) );
197class_alias( SpecialCreateAccount::class,
'SpecialCreateAccount' );
wfCgiToArray( $query)
This is the logical opposite of wfArrayToCgi(): it accepts a query string as its argument and returns...
Group all the pieces relevant to the context of a request into one instance.
An error page which can definitely be safely rendered using the OutputPage.
string $subPage
Subpage of the special page.
getRequest()
Get the WebRequest being used for this instance.WebRequest 1.18
Holds shared logic for login and account creation pages.
showSuccessPage( $type, $title, $msgname, $injected_html, $extraMessages)
Show the success page.
getUser()
Shortcut to get the User executing this instance.
setAuthManager(AuthManager $authManager)
Set the injected AuthManager from the special page constructor.
getPageTitle( $subpage=false)
Get a self-referential title object.
getContext()
Gets the context this SpecialPage is executed in.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getOutput()
Get the OutputPage being used for this instance.
getAuthority()
Shortcut to get the Authority executing this instance.
getName()
Get the canonical, unlocalized name of this special page without namespace.
Generic operation result class Has warning/error list, boolean status and arbitrary value.