40 parent::__construct(
'ChangePassword',
'editmyprivateinfo' );
59 parent::checkExecutePermissions( $user );
72 $this->mPreTextMessage = $msg;
81 $this->mOldPassMsg = $msg;
89 if ( $oldpassMsg === null ) {
90 $oldpassMsg =
$user->isLoggedIn() ?
'oldpassword' :
'resetpass-temp-password';
96 'label-message' =>
'username',
100 'type' =>
'password',
101 'label-message' => $oldpassMsg,
104 'type' =>
'password',
105 'label-message' =>
'newpassword',
108 'type' =>
'password',
109 'label-message' =>
'retypenew',
113 if ( !$this->
getUser()->isLoggedIn() ) {
114 $fields[
'LoginOnChangeToken'] = [
116 'label' =>
'Change Password Token',
117 'default' => LoginForm::getLoginToken()->toString(),
122 Hooks::run(
'ChangePasswordForm', [ &$extraFields ] );
123 foreach ( $extraFields
as $extra ) {
128 'label-message' => $label,
129 'default' => $default,
133 if ( !
$user->isLoggedIn() ) {
134 $fields[
'Remember'] = [
136 'label' => $this->
msg(
'remembermypassword' )
138 ceil( $this->
getConfig()->
get(
'CookieExpiration' ) / ( 3600 * 24 ) )
140 'default' =>
$request->getVal(
'wpRemember' ),
148 $form->
setId(
'mw-resetpass-form' );
153 ?
'resetpass-submit-loggedin'
157 'name' =>
'wpCancel',
158 'value' => $this->
msg(
'resetpass-submit-cancel' )->
text()
161 if ( $this->mPreTextMessage instanceof
Message ) {
162 $form->
addPreText( $this->mPreTextMessage->parseAsBlock() );
165 $this->
getRequest()->getValues(
'wpName',
'wpDomain',
'returnto',
'returntoquery' ) );
173 if (
$request->getCheck(
'wpLoginToken' ) ) {
178 if ( !$this->
getUser()->isLoggedIn()
179 && !LoginForm::getLoginToken()->match(
$request->getVal(
'wpLoginOnChangeToken' ) )
185 if (
$request->getCheck(
'wpCancel' ) ) {
186 $returnto =
$request->getVal(
'returnto' );
188 if ( !$titleObj instanceof
Title ) {
198 $this->mDomain = $wgAuth->getDomain();
200 if ( !$wgAuth->allowPasswordChange() ) {
201 throw new ErrorPageError(
'changepassword',
'resetpass_forbidden' );
210 if ( $this->
getUser()->isLoggedIn() ) {
212 "<div class=\"successbox\">\n$1\n</div>",
213 'changepassword-success'
218 LoginForm::clearLoginToken();
219 $token = LoginForm::getLoginToken()->toString();
221 'action' =>
'submitlogin',
224 'wpLoginToken' => $token,
225 'wpPassword' =>
$request->getVal(
'wpNewPassword' ),
226 ] +
$request->getValues(
'wpRemember',
'returnto',
'returntoquery' );
229 $login->execute( null );
244 $isSelf = ( $this->mUserName === $this->
getUser()->getName() );
255 if ( $newpass !== $retype ) {
260 $throttleInfo = LoginForm::incrementLoginThrottle( $this->mUserName );
261 if ( $throttleInfo ) {
263 ->durationParams( $throttleInfo[
'wait'] )
268 if ( !
$user->checkTemporaryPassword( $oldpass ) && !
$user->checkPassword( $oldpass ) ) {
269 Hooks::run(
'PrefsPasswordAudit', [
$user, $newpass,
'wrongpassword' ] );
274 if ( $oldpass === $newpass ) {
287 LoginForm::clearLoginThrottle( $this->mUserName );
290 $user->setPassword( $newpass );
300 $remember = $this->
getRequest()->getCookie(
'Token' ) !== null;
301 $user->setCookies( null, null, $remember );
303 $user->saveSettings();
323 if ( $wgPasswordExpirationDays ) {
326 time() + ( $wgPasswordExpirationDays * 24 * 3600 )
330 Hooks::run(
'ResetPasswordExpiration', [ $this, &$newExpire ] );
334 [
'user_password_expires' => $dbw->timestampOrNull( $newExpire ) ],
335 [
'user_id' => $user->
getId() ],
static newFromName($name, $validate= 'valid')
Static factory method for creation from username.
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
wfGetDB($db, $groups=[], $wiki=false)
Get a Database object.
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
$wgPasswordExpirationDays
The number of days that a user's password is good for.
getContext()
Gets the context this SpecialPage is executed in.
static newMainPage()
Create a new Title for the Main Page.
alterForm(HTMLForm $form)
resetPasswordExpiration(User $user)
For resetting user password expiration, until AuthManager comes along.
The Message class provides methods which fulfil two basic services:
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException'returning false will NOT prevent logging $e
Similar to FauxRequest, but only fakes URL parameters and method (POST or GET) and use the base reque...
setOldPasswordMessage($msg)
Set a message at the top of the Change Password form.
msg()
Wrapper around wfMessage that sets the current context.
setChangeMessage(Message $msg)
Set a message at the top of the Change Password form.
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.
The User object encapsulates all of the user-specific settings (user_id, name, rights, email address, options, last login time).
wfTimestamp($outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Let users recover their password.
An error page which can definitely be safely rendered using the OutputPage.
execute($par)
Main execution point.
listed($x=null)
Get or set whether this special page is listed in Special:SpecialPages.
static run($event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
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
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
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
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
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.
getId()
Get the user's ID.
Show an error when any operation involving passwords fails to run.
Variant of the Message class.
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.
checkExecutePermissions(User $user)
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set $status
attemptReset($oldpass, $newpass, $retype)
Checks the new password if it meets the requirements for passwords and set it as a current password...
getRequest()
Get the WebRequest being used for this instance.
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 incomplete & $abortMsg
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached one of or reset my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
static newGood($value=null)
Factory function for good results.
Allows to change the fields on the form that will be generated $name