59 if ( isset(
$params[
'emailEnabled'] ) ) {
60 $this->emailEnabled = (bool)
$params[
'emailEnabled'];
62 if ( isset(
$params[
'newPasswordExpiry'] ) ) {
63 $this->newPasswordExpiry = (int)
$params[
'newPasswordExpiry'];
65 if ( isset(
$params[
'passwordReminderResendTime'] ) ) {
66 $this->passwordReminderResendTime =
$params[
'passwordReminderResendTime'];
73 if ( $this->emailEnabled ===
null ) {
74 $this->emailEnabled = $this->config->get(
'EnableEmail' );
76 if ( $this->newPasswordExpiry ===
null ) {
77 $this->newPasswordExpiry = $this->config->get(
'NewPasswordExpiry' );
79 if ( $this->passwordReminderResendTime ===
null ) {
80 $this->passwordReminderResendTime = $this->config->get(
'PasswordReminderResendTime' );
87 'msg' =>
wfMessage(
'resetpass-temp-emailed' ),
101 if ( isset(
$options[
'username'] ) && $this->emailEnabled ) {
120 if ( !
$req ||
$req->username ===
null ||
$req->password ===
null ) {
124 $username = User::getCanonicalName(
$req->username,
'usable' );
130 $row =
$dbr->selectRow(
133 'user_id',
'user_newpassword',
'user_newpass_time',
148 $pwhash = $this->
getPassword( $row->user_newpassword );
149 if ( !$pwhash->equals(
$req->password ) ) {
169 $row =
$dbr->selectRow(
171 [
'user_newpassword',
'user_newpass_time' ],
197 return (
bool)
wfGetDB( $db )->selectField(
209 if ( get_class(
$req ) !== TemporaryPasswordAuthenticationRequest::class ) {
211 return \StatusValue::newGood(
'ignored' );
215 return \StatusValue::newGood();
218 $username = User::getCanonicalName(
$req->username,
'usable' );
220 return \StatusValue::newGood(
'ignored' );
225 [
'user_id',
'user_newpass_time' ],
231 return \StatusValue::newGood(
'ignored' );
234 $sv = \StatusValue::newGood();
235 if (
$req->password !==
null ) {
238 if (
$req->mailpassword ) {
239 if ( !$this->emailEnabled && !
$req->hasBackchannel ) {
240 return \StatusValue::newFatal(
'passwordreset-emaildisabled' );
249 $this->passwordReminderResendTime
250 && $row->user_newpass_time
252 + $this->passwordReminderResendTime * 3600
256 return \StatusValue::newFatal(
'throttled-mailpassword',
257 round( $this->passwordReminderResendTime, 3 ) );
260 if ( !
$req->caller ) {
261 return \StatusValue::newFatal(
'passwordreset-nocaller' );
264 $caller = User::newFromName(
$req->caller );
266 return \StatusValue::newFatal(
'passwordreset-nosuchcaller',
$req->caller );
275 $username =
$req->username !==
null ? User::getCanonicalName(
$req->username,
'usable' ) :
false;
284 get_class(
$req ) === TemporaryPasswordAuthenticationRequest::class
287 $newpassTime = $dbw->timestamp();
288 $sendMail =
$req->mailpassword;
298 'user_newpassword' => $pwhash->toString(),
299 'user_newpass_time' => $newpassTime,
307 $dbw->onTransactionIdle(
324 $reqs, TemporaryPasswordAuthenticationRequest::class
327 $ret = \StatusValue::newGood();
329 if (
$req->mailpassword && !
$req->hasBackchannel ) {
330 if ( !$this->emailEnabled ) {
331 $ret->merge( \StatusValue::newFatal(
'emaildisabled' ) );
332 } elseif ( !
$user->getEmail() ) {
333 $ret->merge( \StatusValue::newFatal(
'noemailcreate' ) );
347 $reqs, TemporaryPasswordAuthenticationRequest::class
350 if (
$req->username !==
null &&
$req->password !==
null ) {
352 if (
$req->username !==
$user->getName() ) {
357 if (
$req->mailpassword ) {
359 $this->manager->setAuthenticationSessionData(
'no-email',
true );
373 $mailpassword =
$req->mailpassword;
374 $req->mailpassword =
false;
379 if ( $mailpassword ) {
389 return $mailpassword ?
'byemail' :
null;
399 if (
$time !==
null ) {
401 if ( time() >= $expiry ) {
419 return \Status::newFatal(
'badipaddress' );
423 \Hooks::run(
'User::mailPasswordInternal', [ &$creatingUser, &$ip, &
$user ] );
425 $mainPageUrl = \Title::newMainPage()->getCanonicalURL();
426 $userLanguage =
$user->getOption(
'language' );
427 $subjectMessage =
wfMessage(
'createaccount-title' )->inLanguage( $userLanguage );
428 $bodyMessage =
wfMessage(
'createaccount-text', $ip,
$user->getName(), $password,
429 '<' . $mainPageUrl .
'>', round( $this->newPasswordExpiry / 86400 ) )
430 ->inLanguage( $userLanguage );
432 $status =
$user->sendMail( $subjectMessage->text(), $bodyMessage->text() );
437 $this->logger->warning(
'Could not send account creation email: ' .
438 $status->getWikiText(
false,
false,
'en' ) );
450 $user = User::newFromName(
$req->username );
452 return \Status::newFatal(
'noname' );
454 $userLanguage =
$user->getOption(
'language' );
455 $callerIsAnon = \IP::isValid(
$req->caller );
456 $callerName = $callerIsAnon ?
$req->caller : User::newFromName(
$req->caller )->getName();
457 $passwordMessage =
wfMessage(
'passwordreset-emailelement',
$user->getName(),
458 $req->password )->inLanguage( $userLanguage );
459 $emailMessage =
wfMessage( $callerIsAnon ?
'passwordreset-emailtext-ip'
460 :
'passwordreset-emailtext-user' )->inLanguage( $userLanguage );
461 $emailMessage->params( $callerName, $passwordMessage->text(), 1,
462 '<' . \Title::newMainPage()->getCanonicalURL() .
'>',
463 round( $this->newPasswordExpiry / 86400 ) );
464 $emailTitle =
wfMessage(
'passwordreset-emailtitle' )->inLanguage( $userLanguage );
465 return $user->sendMail( $emailTitle->text(), $emailMessage->text() );
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
wfTimestampOrNull( $outputtype=TS_UNIX, $ts=null)
Return a formatted timestamp, or null if input is null.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
static isValid( $ip)
Validate an IP address.
Represents an invalid password hash.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
getRequest()
Get the WebRequest object to use with this object.
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
this hook is for auditing only $req
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
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
see documentation in includes Linker php for Linker::makeImageLink & $time
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 and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context $options
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
it s the revision text itself In either if gzip is the revision text is gzipped $flags
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 & $ret
this hook is for auditing only or null if authentication failed before getting that far $username
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
Interface for configuration instances.
const TS_UNIX
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)