36 parent::__construct(
'ChangeEmail',
'editmyprivateinfo' );
49 return $wgAuth->allowPropChange(
'emailaddress' );
58 $out->disallowUserJs();
66 if ( !$wgAuth->allowPropChange(
'emailaddress' ) ) {
74 if ( !$this->
getUser()->isAllowed(
'viewmyprivateinfo' ) ) {
78 parent::checkExecutePermissions( $user );
87 'label-message' =>
'username',
88 'default' =>
$user->getName(),
92 'label-message' =>
'changeemail-oldemail',
93 'default' =>
$user->getEmail() ?: $this->
msg(
'changeemail-none' )->text(),
97 'label-message' =>
'changeemail-newemail',
99 'help-message' =>
'changeemail-newemail-help',
103 if ( $this->
getConfig()->
get(
'RequirePasswordforEmailChange' ) ) {
104 $fields[
'Password'] = [
105 'type' =>
'password',
106 'label-message' =>
'changeemail-password'
118 $form->
setId(
'mw-changeemail-form' );
124 if ( $this->
getConfig()->
get(
'RequirePasswordforEmailChange' ) ) {
125 $form->
addHeaderText( $this->
msg(
'changeemail-passwordrequired' )->parseAsBlock() );
130 $password = isset( $data[
'Password'] ) ? $data[
'Password'] : null;
141 $returnto =
$request->getVal(
'returnto' );
143 if ( !$titleObj instanceof
Title ) {
148 if ( $this->status->value ===
true ) {
150 } elseif ( $this->status->value ===
'eauth' ) {
151 # Notify user that a confirmation email has been sent...
152 $this->
getOutput()->wrapWikiMsg(
"<div class='error' style='clear: both;'>\n$1\n</div>",
172 if ( $newaddr === $user->
getEmail() ) {
176 $throttleInfo = LoginForm::incrementLoginThrottle( $user->
getName() );
177 if ( $throttleInfo ) {
180 'changeemail-throttled',
181 $lang->formatDuration( $throttleInfo[
'wait'] )
185 if ( $this->
getConfig()->get(
'RequirePasswordforEmailChange' )
192 LoginForm::clearLoginThrottle( $user->
getName() );
200 Hooks::run(
'PrefsEmailAudit', [ $user, $oldaddr, $newaddr ] );
204 $wgAuth->updateExternalDB( $user );
getEmail()
Get the user's e-mail address.
alterForm(HTMLForm $form)
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
the array() calling protocol came about after MediaWiki 1.4rc1.
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
checkPassword($password)
Check to see if the given clear-text password is one of the accepted passwords.
saveSettings()
Save this user's settings into the database.
static newMainPage()
Create a new Title for the Main Page.
Let users change their email address.
if(!isset($args[0])) $lang
msg()
Wrapper around wfMessage that sets the current context.
getOutput()
Get the OutputPage being used for this instance.
$wgAuth $wgAuth
Authentication plugin.
static newFromText($text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Represents a title within MediaWiki.
when a variable name is used in a it is silently declared as a new local masking the global
static newFatal($message)
Factory function for fatal errors.
Special page which uses an HTMLForm to handle processing.
getName()
Get the user name, or the IP of an anonymous user.
setEmailWithConfirmation($str)
Set the user's e-mail address and a confirmation mail if needed.
The User object encapsulates all of the user-specific settings (user_id, name, rights, email address, options, last login time).
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.
execute($par)
Main execution point.
static run($event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
attemptChange(User $user, $pass, $newaddr)
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
error also a ContextSource you ll probably need to make sure the header is varied on $request
getName()
Get the name of this Special Page.
requireLogin($reasonMsg= 'exception-nologin-text', $titleMsg= 'exception-nologin')
If the user is not logged in, throws UserNotLoggedIn error.
getUser()
Shortcut to get the User executing this instance.
string $par
The sub-page of the special page.
getConfig()
Shortcut to get main config object.
Show an error when a user tries to do something they do not have the necessary permissions for...
getLanguage()
Shortcut to get user's language.
static validateEmail($addr)
Does a string look like an e-mail address?
getRequest()
Get the WebRequest being used for this instance.
checkTemporaryPassword($plaintext)
Check if the given clear-text password matches the temporary password sent by e-mail for password res...
isGood()
Returns whether the operation completed and didn't have any error or warnings.
checkExecutePermissions(User $user)