Go to the documentation of this file.
44 parent::__construct(
'ChangeEmail',
'editmyprivateinfo' );
53 return $wgAuth->allowPropChange(
'emailaddress' );
66 $out->disallowUserJs();
67 $out->addModules(
'mediawiki.special.changeemail' );
69 if ( !$wgAuth->allowPropChange(
'emailaddress' ) ) {
70 $this->
error(
'cannotchangeemail' );
80 if ( $request->wasPosted() && $request->getBool(
'wpCancel' ) ) {
91 if ( !
$user->isAllowed(
'viewmyprivateinfo' ) ) {
95 $this->mPassword = $request->getVal(
'wpPassword' );
96 $this->mNewEmail = $request->getVal(
'wpNewEmail' );
98 if ( $request->wasPosted()
99 &&
$user->matchEditToken( $request->getVal(
'token' ) )
102 if ( $info ===
true ) {
104 } elseif ( $info ===
'eauth' ) {
105 # Notify user that a confirmation email has been sent...
106 $out->wrapWikiMsg(
"<div class='error' style='clear: both;'>\n$1\n</div>",
107 'eauthentsent',
$user->getName() );
121 if ( !$titleObj instanceof
Title ) {
124 if (
$type ==
'hard' ) {
125 $this->
getOutput()->redirect( $titleObj->getFullURL() );
127 $this->
getOutput()->addReturnTo( $titleObj );
134 protected function error( $msg ) {
135 $this->
getOutput()->wrapWikiMsg(
"<p class='error'>\n$1\n</p>", $msg );
139 global $wgRequirePasswordforEmailChange;
142 $oldEmailText =
$user->getEmail()
144 : $this->
msg(
'changeemail-none' )->text();
152 'id' =>
'mw-changeemail-form' ) ) .
"\n" .
155 $this->
msg(
'changeemail-text' )->parseAsBlock() .
"\n" .
159 array(
'wpName',
'username',
'text',
$user->getName() ),
160 array(
'wpOldEmail',
'changeemail-oldemail',
'text', $oldEmailText ),
161 array(
'wpNewEmail',
'changeemail-newemail',
'email', $this->mNewEmail ),
163 if ( $wgRequirePasswordforEmailChange ) {
164 $items[] =
array(
'wpPassword',
'changeemail-password',
'password', $this->mPassword );
172 '<td class="mw-input">' .
187 protected function pretty( $fields ) {
189 foreach ( $fields
as $list ) {
191 if (
$type ==
'text' ) {
192 $field = htmlspecialchars(
$value );
195 if (
$name ==
'wpPassword' ) {
201 $out .=
"\t<td class='mw-label'>";
202 if (
$type !=
'text' ) {
205 $out .= $this->
msg( $label )->escaped();
208 $out .=
"\t<td class='mw-input'>";
224 global $wgAuth, $wgPasswordAttemptThrottle;
227 $this->
error(
'invalidemailaddress' );
233 if ( $throttleCount ===
true ) {
235 $this->
error(
array(
'changeemail-throttled', $lang->formatDuration( $wgPasswordAttemptThrottle[
'seconds'] ) ) );
240 global $wgRequirePasswordforEmailChange;
241 if ( $wgRequirePasswordforEmailChange && !
$user->checkTemporaryPassword(
$pass ) && !
$user->checkPassword(
$pass ) ) {
242 $this->
error(
'wrongpassword' );
247 if ( $throttleCount ) {
251 $oldaddr =
$user->getEmail();
252 $status =
$user->setEmailWithConfirmation( $newaddr );
253 if ( !$status->isGood() ) {
255 '<p class="error">' .
256 $this->
getOutput()->parseInline( $status->getWikiText(
'mailerror' ) ) .
264 $user->saveSettings();
266 $wgAuth->updateExternalDB(
$user );
268 return $status->value;
getPageTitle( $subpage=false)
Get a self-referential title object.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
string $mNewEmail
Users new email address.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
getOutput()
Get the OutputPage being used for this instance.
Shortcut to construct a special page which is unlisted by default.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
static newMainPage()
Create a new Title for the Main Page.
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
static validateEmail( $addr)
Does a string look like an e-mail address?
static hidden( $name, $value, $attribs=array())
Convenience function to produce an input element with type=hidden.
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.
requireLogin( $reasonMsg=null, $titleMsg=null)
If the user is not logged in, throws UserNotLoggedIn error.
static openElement( $element, $attribs=null)
This opens an XML element.
execute( $par)
Main execution point.
string $mPassword
Users password.
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getUser()
Shortcut to get the User executing this instance.
when a variable name is used in a it is silently declared as a new masking the global
static input( $name, $value='', $type='text', $attribs=array())
Convenience function to produce an "<input>" element.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
doReturnTo( $type='hard')
Allows to change the fields on the form that will be generated $name
msg()
Wrapper around wfMessage that sets the current context.
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...
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 account $user
Represents a title within MediaWiki.
static closeElement( $element)
Shortcut to close an XML element.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
static submitButton( $value, $attribs=array())
Convenience function to build an HTML submit button.
checkReadOnly()
If the wiki is currently in readonly mode, throws a ReadOnlyError.
static label( $label, $id, $attribs=array())
Convenience function to build an HTML form label.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing & $attribs
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
static fieldset( $legend=false, $content=false, $attribs=array())
Shortcut for creating fieldsets.