38 parent::__construct(
'ChangeEmail',
'editmyprivateinfo' );
49 return AuthManager::singleton()->allowsPropertyChange(
'emailaddress' );
60 $out->disallowUserJs();
62 parent::execute(
$par );
67 if ( !AuthManager::singleton()->allowsPropertyChange(
'emailaddress' ) ) {
75 if ( !$this->
getUser()->isAllowed(
'viewmyprivateinfo' ) ) {
79 parent::checkExecutePermissions(
$user );
88 'label-message' =>
'username',
89 'default' =>
$user->getName(),
93 'label-message' =>
'changeemail-oldemail',
94 'default' =>
$user->getEmail() ?: $this->
msg(
'changeemail-none' )->text(),
98 'label-message' =>
'changeemail-newemail',
100 'help-message' =>
'changeemail-newemail-help',
112 $form->
setId(
'mw-changeemail-form' );
131 $returnto =
$request->getVal(
'returnto' );
132 $titleObj = $returnto !==
null ? Title::newFromText( $returnto ) :
null;
133 if ( !$titleObj instanceof
Title ) {
134 $titleObj = Title::newMainPage();
138 if ( $this->status->value ===
true ) {
139 $this->
getOutput()->redirect( $titleObj->getFullUrlForRedirect(
$query ) );
140 } elseif ( $this->status->value ===
'eauth' ) {
141 # Notify user that a confirmation email has been sent...
142 $this->
getOutput()->wrapWikiMsg(
"<div class='error' style='clear: both;'>\n$1\n</div>",
155 $authManager = AuthManager::singleton();
157 if ( $newaddr !=
'' && !Sanitizer::validateEmail( $newaddr ) ) {
158 return Status::newFatal(
'invalidemailaddress' );
161 if ( $newaddr ===
$user->getEmail() ) {
162 return Status::newFatal(
'changeemail-nochange' );
165 $oldaddr =
$user->getEmail();
171 Hooks::run(
'PrefsEmailAudit', [
$user, $oldaddr, $newaddr ] );
173 $user->saveSettings();
174 MediaWiki\Auth\AuthManager::callLegacyAuthPlugin(
'updateExternalDB', [
$user ] );
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
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.
Special page which uses an HTMLForm to handle processing.
string $par
The sub-page of the special page.
Show an error when a user tries to do something they do not have the necessary permissions for.
Let users change their email address.
doesWrites()
Indicates whether this special page may perform database writes.
requiresUnblock()
Whether this action cannot be executed by a blocked user.
getDisplayFormat()
Get display format for the form.
onSuccess()
Do something exciting on successful processing of the form, most likely to show a confirmation messag...
alterForm(HTMLForm $form)
Play with the HTMLForm if you need to more substantially.
getFormFields()
Get an HTMLForm descriptor array.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
attemptChange(User $user, $newaddr)
checkExecutePermissions(User $user)
Called from execute() to check if the given user can perform this action.
execute( $par)
Main execution point.
onSubmit(array $data)
Process the form on POST submission.
getName()
Get the name of this Special Page.
getOutput()
Get the OutputPage being used for this instance.
requireLogin( $reasonMsg='exception-nologin-text', $titleMsg='exception-nologin')
If the user is not logged in, throws UserNotLoggedIn error.
checkLoginSecurityLevel( $level=null)
Verifies that the user meets the security level, possibly reauthenticating them in the process.
getUser()
Shortcut to get the User executing this instance.
getRequest()
Get the WebRequest being used for this instance.
msg()
Wrapper around wfMessage that sets the current context.
isGood()
Returns whether the operation completed and didn't have any error or warnings.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Represents a title within MediaWiki.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
the array() calling protocol came about after MediaWiki 1.4rc1.
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
error also a ContextSource you ll probably need to make sure the header is varied on $request
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
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
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