Go to the documentation of this file.
46 parent::__construct(
'PasswordReset',
'editmyprivateinfo' );
55 if ( is_string(
$error ) ) {
58 throw new ErrorPageError(
'internalerror',
'resetpass_forbidden' );
61 return parent::checkExecutePermissions(
$user );
65 global $wgPasswordResetRoutes, $wgAuth;
67 if ( isset( $wgPasswordResetRoutes[
'username'] ) && $wgPasswordResetRoutes[
'username'] ) {
68 $a[
'Username'] =
array(
70 'label-message' =>
'passwordreset-username',
73 if ( $this->
getUser()->isLoggedIn() ) {
74 $a[
'Username'][
'default'] = $this->
getUser()->getName();
78 if ( isset( $wgPasswordResetRoutes[
'email'] ) && $wgPasswordResetRoutes[
'email'] ) {
81 'label-message' =>
'passwordreset-email',
85 if ( isset( $wgPasswordResetRoutes[
'domain'] ) && $wgPasswordResetRoutes[
'domain'] ) {
86 $domains = $wgAuth->domainList();
89 'options' => $domains,
90 'label-message' =>
'passwordreset-domain',
94 if ( $this->
getUser()->isAllowed(
'passwordreset' ) ) {
95 $a[
'Capture'] =
array(
97 'label-message' =>
'passwordreset-capture',
98 'help-message' =>
'passwordreset-capture-help',
106 global $wgPasswordResetRoutes;
108 $form->setDisplayFormat(
'vform' );
113 $form->setWrapperLegend(
false );
115 $form->addHiddenFields( $this->
getRequest()->getValues(
'returnto',
'returntoquery' ) );
118 if ( isset( $wgPasswordResetRoutes[
'username'] ) && $wgPasswordResetRoutes[
'username'] ) {
121 if ( isset( $wgPasswordResetRoutes[
'email'] ) && $wgPasswordResetRoutes[
'email'] ) {
124 if ( isset( $wgPasswordResetRoutes[
'domain'] ) && $wgPasswordResetRoutes[
'domain'] ) {
128 $message = ( $i > 1 ) ?
'passwordreset-text-many' :
'passwordreset-text-one';
130 $form->setHeaderText( $this->
msg( $message, $i )->parseAsBlock() );
131 $form->setSubmitTextMsg(
'mailmypassword' );
146 if ( isset( $data[
'Domain'] ) ) {
147 if ( $wgAuth->validDomain( $data[
'Domain'] ) ) {
148 $wgAuth->setDomain( $data[
'Domain'] );
150 $wgAuth->setDomain(
'invaliddomain' );
154 if ( isset( $data[
'Capture'] ) && !$this->
getUser()->isAllowed(
'passwordreset' ) ) {
165 if ( isset( $data[
'Username'] ) && $data[
'Username'] !==
'' ) {
166 $method =
'username';
168 } elseif ( isset( $data[
'Email'] )
169 && $data[
'Email'] !==
''
176 array(
'user_email' => $data[
'Email'] ),
183 foreach (
$res as $row ) {
188 throw new MWException(
'Unknown database error in ' . __METHOD__ );
201 if ( count( $users ) == 0 ) {
202 if ( $method ==
'email' ) {
206 return array(
'noname' );
218 if ( $this->
getUser()->pingLimiter(
'mailpassword' ) ) {
224 if (
$user->isPasswordReminderThrottled() ) {
225 global $wgPasswordReminderResendTime;
227 # Round the time in hours to 3 d.p., in case someone is specifying
228 # minutes or seconds.
230 'throttled-mailpassword',
231 round( $wgPasswordReminderResendTime, 3 )
236 global $wgNewPasswordExpiry;
248 return array(
'badipaddress' );
252 $username = $caller->getName();
254 ?
'passwordreset-emailtext-ip'
255 :
'passwordreset-emailtext-user';
260 $passwords =
array();
264 $user->saveSettings();
265 $passwords[] = $this->
msg(
'passwordreset-emailelement', $user->getName(),
$password )
266 ->inLanguage( $userLanguage )->text();
268 $passwordBlock = implode(
"\n\n", $passwords );
270 $this->email = $this->
msg( $msg )->inLanguage( $userLanguage );
271 $this->email->params(
276 round( $wgNewPasswordExpiry / 86400 )
279 $title = $this->
msg(
'passwordreset-emailtitle' );
283 if ( isset( $data[
'Capture'] ) && $data[
'Capture'] ) {
291 if ( $this->result->isGood() ) {
293 } elseif ( isset( $data[
'Capture'] ) && $data[
'Capture'] ) {
300 return array(
array(
'mailerror', $this->result->getMessage() ) );
305 if ( $this->
getUser()->isAllowed(
'passwordreset' ) && $this->email !=
null ) {
308 if ( $this->result->isGood() ) {
309 $this->
getOutput()->addWikiMsg(
'passwordreset-emailsent-capture' );
311 $this->
getOutput()->addWikiMsg(
'passwordreset-emailerror-capture',
312 $this->result->getMessage(), $this->firstUser->getName() );
318 $this->
getOutput()->addWikiMsg(
'passwordreset-emailsent' );
323 global $wgPasswordResetRoutes, $wgEnableEmail, $wgAuth;
326 if ( !is_array( $wgPasswordResetRoutes ) ||
327 !in_array(
true, array_values( $wgPasswordResetRoutes ) )
329 return 'passwordreset-disabled';
333 if ( !$wgAuth->allowPasswordChange() ) {
334 return 'resetpass_forbidden';
338 if ( !$wgEnableEmail ) {
339 return 'passwordreset-emaildisabled';
344 if (
$user->isBlocked() ) {
345 return 'blocked-mailpassword';
357 return parent::isListed();
Special page for requesting a password reset email.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
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.
isListed()
Hide the password reset page if resets are disabled.
getFormFields()
Get an HTMLForm descriptor array.
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
static newMainPage()
Create a new Title for the Main Page.
usually copyright or history_copyright This message must be in HTML not wikitext $subpages will be ignored and the rest of subPageSubtitle() will run. 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink' whether MediaWiki currently thinks this is a CSS JS page Hooks may change this value to override the return value of Title::isCssOrJsPage(). 'TitleIsAlwaysKnown' whether MediaWiki currently thinks this page is known isMovable() always returns false. $title whether MediaWiki currently thinks this page is movable Hooks may change this value to override the return value of Title::isMovable(). 'TitleIsWikitextPage' whether MediaWiki currently thinks this is a wikitext page Hooks may change this value to override the return value of Title::isWikitextPage() 'TitleMove' use UploadVerification and UploadVerifyFile instead $form
static validateEmail( $addr)
Does a string look like an e-mail address?
Special page which uses an HTMLForm to handle processing.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Show an error when a user tries to do something they do not have the necessary permissions for.
static newFromRow( $row, $data=null)
Create a new user object from a user row.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
getEmail()
Get the user's e-mail address.
onSubmit(array $data)
Process the form.
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
Show an error when the user hits a rate limit.
checkExecutePermissions(User $user)
Called from execute() to check if the given user can perform this action.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
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
onSuccess()
Do something exciting on successful processing of the form, most likely to show a confirmation messag...
presenting them properly to the user as errors is done by the caller $title
msg()
Wrapper around wfMessage that sets the current context.
getOption( $oname, $defaultOverride=null, $ignoreHidden=false)
Get the user's current setting for a given option.
getRequest()
Get the WebRequest being used for this instance.
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
static isValid( $ip)
Validate an IP address.
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
return false to override stock group addition can be modified try getUserPermissionsErrors userCan checks are continued by internal code can override on output return false to not delete it return false to override the default password checks this Boolean value will be checked to determine if the password was valid return false to implement your own hashing method & $password
userCanExecute(User $user)
Checks if the given user (identified by an object) can execute this special page (as defined by $mRes...
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
alterForm(HTMLForm $form)
Play with the HTMLForm if you need to more substantially.
sendMail( $subject, $body, $from=null, $replyto=null)
Send an e-mail to this user's account.
static selectFields()
Return the list of user fields that should be selected to create a new user object.
usually copyright or history_copyright This message must be in HTML not wikitext $subpages will be ignored and the rest of subPageSubtitle() will run. 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink' whether MediaWiki currently thinks this is a CSS JS page Hooks may change this value to override the return value of Title::isCssOrJsPage(). 'TitleIsAlwaysKnown' whether MediaWiki currently thinks this page is known isMovable() always returns false. $title whether MediaWiki currently thinks this page is movable Hooks may change this value to override the return value of Title::isMovable(). 'TitleIsWikitextPage' whether MediaWiki currently thinks this is a wikitext page Hooks may change this value to override the return value of Title::isWikitextPage() 'TitleMove' use UploadVerification and UploadVerifyFile instead where the first element is the message key and the remaining elements are used as parameters to the message based on mime etc Preferred in most cases over UploadVerification object with all info about the upload string as detected by MediaWiki Handlers will typically only apply for specific mime types object & $error
static rawElement( $element, $attribs=array(), $contents='')
Returns an HTML element in a string.
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,...
canChangePassword(User $user)
getName()
Get the user name, or the IP of an anonymous user.