Go to the documentation of this file.
35 AuthManager::ACTION_CREATE,
36 AuthManager::ACTION_CREATE_CONTINUE
40 'authform-newtoken' =>
'nocookiesfornew',
41 'authform-notoken' =>
'sessionfailure',
42 'authform-wrongtoken' =>
'sessionfailure',
46 parent::__construct(
'CreateAccount' );
54 return !MediaWikiServices::getInstance()
55 ->getPermissionManager()
56 ->groupHasPermission(
'*',
'createaccount' );
60 return MediaWikiServices::getInstance()
61 ->getPermissionManager()
62 ->userHasRight( $user,
'createaccount' );
66 parent::checkPermissions();
69 $status = AuthManager::singleton()->checkAccountCreatePermissions( $user );
72 if ( $user->isBlockedFromCreateAccount() ) {
73 MediaWikiServices::getInstance()->getBlockManager()->trackBlockWithCookie( $user );
84 return AuthManager::ACTION_CREATE;
88 return $this->
msg(
'createaccount' )->text();
104 $user = $this->targetUser ?: $this->
getUser();
107 # Only save preferences if the user is not creating an account for someone else.
108 if ( !$this->proxyAccountCreation ) {
109 Hooks::run(
'AddNewAccount', [ $user,
false ] );
114 $this->
mainLoginForm( [ ], $session->getProvider()->whyNoSession() );
122 Hooks::run(
'AddNewAccount', [ $user, $byEmail ] );
125 $out->setPageTitle( $this->
msg( $byEmail ?
'accmailtitle' :
'accountcreated' ) );
127 $out->addWikiMsg(
'accmailtext', $user->getName(), $user->getEmail() );
129 $out->addWikiMsg(
'accountcreatedtext', $user->getName() );
134 ( $rt && !$rt->isExternal() ) ? $rt : $this->
getPageTitle(),
143 # Run any hooks; display injected HTML
145 $welcome_creation_msg =
'welcomecreation-msg';
146 Hooks::run(
'UserLoginComplete', [ &$user, &$injected_html, $direct ] );
153 Hooks::run(
'BeforeWelcomeCreation', [ &$welcome_creation_msg, &$injected_html ] );
156 $welcome_creation_msg, $injected_html, $extraMessages );
160 return $this->
getRequest()->getSession()->getToken(
'',
'createaccount' );
164 return $this->
getRequest()->getSession()->resetToken(
'createaccount' );
168 return 'wpCreateaccountToken';
176 LoggerFactory::getInstance(
'authevents' )->info(
'Account creation attempt', [
177 'event' =>
'accountcreation',
getPageTitle( $subpage=false)
Get a self-referential title object.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
getDefaultAction( $subPage)
Get the default action for this special page, if none is given via URL/POST data.
getOutput()
Get the OutputPage being used for this instance.
showSuccessPage( $type, $title, $msgname, $injected_html, $extraMessages)
Show the success page.
getTokenName()
Returns the name of the CSRF token (under which it should be found in the POST or GET data).
doesWrites()
Indicates whether this special page may perform database writes.
getName()
Get the name of this Special Page.
successfulAction( $direct=false, $extraMessages=null)
Run any hooks registered for logins, then display a message welcoming the user.
Implements Special:CreateAccount.
getDescription()
Returns the name that goes in the <h1> in the special page itself, and also the name that will be l...
string $subPage
Subpage of the special page.
Holds shared logic for login and account creation pages.
getLoginSecurityLevel()
Tells if the special page does something security-sensitive and needs extra defense against a stolen ...
wfCgiToArray( $query)
This is the logical opposite of wfArrayToCgi(): it accepts a query string as its argument and returns...
mainLoginForm(array $requests, $msg='', $msgtype='error')
getUser()
Shortcut to get the User executing this instance.
hasSessionCookie()
Check if a session cookie is present.
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...
getToken()
Returns the CSRF token.
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
isRestricted()
Can be overridden by subclasses with more complicated permissions schemes.
getRequest()
Get the WebRequest being used for this instance.
userCanExecute(User $user)
Checks if the given user (identified by an object) can execute this special page (as defined by $mRes...
An error page which can definitely be safely rendered using the OutputPage.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.