Go to the documentation of this file.
40 parent::__construct(
'ChangeEmail',
'editmyprivateinfo' );
51 return AuthManager::singleton()->allowsPropertyChange(
'emailaddress' );
60 $out->disallowUserJs();
62 parent::execute(
$par );
70 if ( !AuthManager::singleton()->allowsPropertyChange(
'emailaddress' ) ) {
78 if ( !MediaWikiServices::getInstance()
80 ->userHasRight( $this->
getUser(),
'viewmyprivateinfo' )
85 parent::checkExecutePermissions( $user );
94 'label-message' =>
'username',
95 'default' => $user->getName(),
99 'label-message' =>
'changeemail-oldemail',
100 'default' => $user->getEmail() ?: $this->
msg(
'changeemail-none' )->text(),
104 'label-message' =>
'changeemail-newemail',
106 'help-message' =>
'changeemail-newemail-help',
118 $form->
setId(
'mw-changeemail-form' );
137 $returnto = $request->getVal(
'returnto' );
139 if ( !$titleObj instanceof
Title ) {
142 $query = $request->getVal(
'returntoquery' );
144 if ( $this->status->value ===
true ) {
145 $this->
getOutput()->redirect( $titleObj->getFullUrlForRedirect( $query ) );
146 } elseif ( $this->status->value ===
'eauth' ) {
147 # Notify user that a confirmation email has been sent...
148 $this->
getOutput()->wrapWikiMsg(
"<div class='error' style='clear: both;'>\n$1\n</div>",
161 if ( $newaddr !=
'' && !Sanitizer::validateEmail( $newaddr ) ) {
165 if ( $newaddr === $user->
getEmail() ) {
171 if ( $newaddr !==
'' && $user->
pingLimiter(
'changeemail' ) ) {
181 LoggerFactory::getInstance(
'authentication' )->info(
182 'Changing email address for {user} from {oldemail} to {newemail}', [
184 'oldemail' => $oldaddr,
185 'newemail' => $newaddr,
189 Hooks::run(
'PrefsEmailAudit', [ $user, $oldaddr, $newaddr ] );
requiresUnblock()
Whether this action cannot be executed by a blocked user.
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.
static newFatal( $message,... $parameters)
Factory function for fatal errors.
doesWrites()
Indicates whether this special page may perform database writes.
getOutput()
Get the OutputPage being used for this instance.
attemptChange(User $user, $newaddr)
onSuccess()
Do something exciting on successful processing of the form, most likely to show a confirmation messag...
getLoginSecurityLevel()
Tells if the special page does something security-sensitive and needs extra defense against a stolen ...
setEmailWithConfirmation( $str)
Set the user's e-mail address and a confirmation mail if needed.
checkExecutePermissions(User $user)
Called from execute() to check if the given user can perform this action.
alterForm(HTMLForm $form)
Play with the HTMLForm if you need to more substantially.
Special page which uses an HTMLForm to handle processing.
Show an error when a user tries to do something they do not have the necessary permissions for.
static newMainPage(MessageLocalizer $localizer=null)
Create a new Title for the Main Page.
pingLimiter( $action='edit', $incrBy=1)
Primitive rate limits: enforce maximum actions per time period to put a brake on flooding.
getName()
Get the name of this Special Page.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
getFormFields()
Get an HTMLForm descriptor array.
getEmail()
Get the user's e-mail address.
isGood()
Returns whether the operation completed and didn't have any error or warnings.
execute( $par)
Main execution point.
wfCgiToArray( $query)
This is the logical opposite of wfArrayToCgi(): it accepts a query string as its argument and returns...
getUser()
Shortcut to get the User executing this instance.
saveSettings()
Save this user's settings into the database.
string null $par
The sub-page of the special page.
requireLogin( $reasonMsg='exception-nologin-text', $titleMsg='exception-nologin')
If the user is not logged in, throws UserNotLoggedIn error.
getDisplayFormat()
Get display format for the form.
Let users change their email address.
getRequest()
Get the WebRequest being used for this instance.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Represents a title within MediaWiki.
onSubmit(array $data)
Process the form on POST submission.
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.
getName()
Get the user name, or the IP of an anonymous user.