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 );
71if ( !$status->isGood() ) {
72 $formatter = $this->formatterFactory->getStatusFormatter( $this->
getContext() );
74foreach ( $status->getMessages() as $message ) {
78false, $performer->getUser(),
83 $formatter->getMessage( $status )
95return AuthManager::ACTION_CREATE;
100return $this->
msg(
'createaccount' );
117 $user = $this->targetUser ?: $this->
getUser();
121 # Only save preferences if the user is not creating an account for someone else. 122if ( !$this->proxyAccountCreation ) {
125 $byEmail =
false;
// FIXME no way to set this 130// @phan-suppress-next-line PhanImpossibleCondition 131 $out->setPageTitleMsg( $this->
msg( $byEmail ?
'accmailtitle' :
'accountcreated' ) );
132// @phan-suppress-next-line PhanImpossibleCondition 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 );
161// T308471: ensure username is plaintext (aka escaped) 163 $welcome_creation_msg, $injected_html, $extraMessages );
168return $this->
getRequest()->getSession()->getToken(
'',
'createaccount' );
172 $this->
getRequest()->getSession()->resetToken(
'createaccount' );
177return'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...
AuthManager is the authentication system in MediaWiki and serves entry point for authentication.
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.
Factory for formatters of common complex objects.
Create PSR-3 logger objects.
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.
Implements Special:CreateAccount.
logAuthResult( $success, UserIdentity $performer, $status=null)
Logs to the authmanager-stats channel.
getToken()
Returns the CSRF token.to override Token
getDefaultAction( $subPage)
Get the default action for this special page if none is given via URL/POST data.Subclasses should ove...
getLoginSecurityLevel()
to override bool|string
getDescription()
Returns the name that goes in the <h1> in the special page itself, and also the name that will be l...
__construct(AuthManager $authManager, FormatterFactory $formatterFactory, UserIdentityUtils $identityUtils)
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
successfulAction( $direct=false, $extraMessages=null)
Run any hooks registered for logins, then display a message welcoming the user.
doesWrites()
Indicates whether POST requests to this special page require write access to the wiki....
Represents a title within MediaWiki.
Convenience functions for interpreting UserIdentity objects using additional services or config.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Interface for objects representing user identity.