42 AuthManager::ACTION_CREATE,
43 AuthManager::ACTION_CREATE_CONTINUE
48 'authform-newtoken' =>
'nocookiesfornew',
49 'authform-notoken' =>
'sessionfailure',
50 'authform-wrongtoken' =>
'sessionfailure',
67 parent::__construct(
'CreateAccount',
'createaccount' );
70 $this->formatterFactory = $formatterFactory;
71 $this->identityUtils = $identityUtils;
79 parent::checkPermissions();
84 $status = $this->mPosted ?
85 $authManager->authorizeCreateAccount( $performer ) :
86 $authManager->probablyCanCreateAccount( $performer );
88 if ( !$status->isGood() ) {
89 $formatter = $this->formatterFactory->getStatusFormatter( $this->
getContext() );
92 $formatter->getMessage( $status )
102 return AuthManager::ACTION_CREATE;
106 return $this->
msg(
'createaccount' );
122 $user = $this->targetUser ?: $this->
getUser();
126 # Only save preferences if the user is not creating an account for someone else.
127 if ( !$this->proxyAccountCreation ) {
133 $this->
mainLoginForm( [ ], $session->getProvider()->whyNoSession() );
145 $out->setPageTitleMsg( $this->
msg( $byEmail ?
'accmailtitle' :
'accountcreated' ) );
148 $out->addWikiMsg(
'accmailtext', $user->getName(), $user->getEmail() );
150 $out->addWikiMsg(
'accountcreatedtext', $user->getName() );
153 $rt = Title::newFromText( $this->mReturnTo );
155 ( $rt && !$rt->isExternal() ) ? $rt : $this->
getPageTitle(),
160 $this->
getHookRunner()->onUserLoginComplete( $user, $injected_html, $direct );
165 # Run any hooks; display injected HTML
166 $welcome_creation_msg =
'welcomecreation-msg';
172 $this->
getHookRunner()->onBeforeWelcomeCreation( $welcome_creation_msg, $injected_html );
177 $welcome_creation_msg, $injected_html, $extraMessages );
181 return $this->
getRequest()->getSession()->getToken(
'',
'createaccount' );
185 $this->
getRequest()->getSession()->resetToken(
'createaccount' );
189 return 'wpCreateaccountToken';
197 LoggerFactory::getInstance(
'authevents' )->info(
'Account creation attempt', [
198 'event' =>
'accountcreation',
200 'accountType' => $this->identityUtils->getShortUserTypeInternal( $performer ),
201 'status' => strval( $status ),
207class_alias( SpecialCreateAccount::class,
'SpecialCreateAccount' );
wfCgiToArray( $query)
This is the logical opposite of wfArrayToCgi(): it accepts a query string as its argument and returns...
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.
Holds shared logic for login and account creation pages.
showSuccessPage( $type, $title, $msgname, $injected_html, $extraMessages)
Show the success page.
mainLoginForm(array $requests, $msg='', $msgtype='error')
hasSessionCookie()
Check if a session cookie is present.
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.