22 namespace MediaWiki\Auth;
46 $this->loginOnly = !empty(
$params[
'loginOnly'] );
52 if ( $expiration === null || $expiration >= $now ) {
56 $grace = $this->config->get(
'PasswordExpireGrace' );
57 if ( $expiration + $grace < $now ) {
78 if (
$req->username === null ||
$req->password === null ) {
88 'user_id',
'user_password',
'user_password_expires',
92 $row = $dbw->selectRow(
104 if ( preg_match(
'/^[0-9a-f]{32}$/', $row->user_password ) ) {
105 if ( $this->config->get(
'PasswordSalt' ) ) {
106 $row->user_password =
":A:{$row->user_id}:{$row->user_password}";
108 $row->user_password =
":A:{$row->user_password}";
118 $pwhash = $this->
getPassword( $row->user_password );
119 if ( !$pwhash->equals(
$req->password ) ) {
120 if ( $this->config->get(
'LegacyEncoding' ) ) {
123 $cp1252Password = iconv(
'UTF-8',
'WINDOWS-1252//TRANSLIT',
$req->password );
124 if ( $cp1252Password ===
$req->password || !$pwhash->equals( $cp1252Password ) ) {
137 [
'user_password' => $pwhash->toString() ],
138 [
'user_id' => $row->user_id ],
156 $row = $dbw->selectRow(
168 if ( preg_match(
'/^[0-9a-f]{32}$/', $row->user_password ) ) {
172 return !$this->
getPassword( $row->user_password ) instanceof \InvalidPassword;
182 return (
bool)
wfGetDB( $db )->selectField(
196 if ( $this->loginOnly ) {
197 return \StatusValue::newGood(
'ignored' );
202 return \StatusValue::newGood();
215 if ( $req->password !== null ) {
216 if ( $req->password !== $req->retype ) {
217 $sv->fatal(
'badretype' );
227 return \StatusValue::newGood(
'ignored' );
238 if ( $this->loginOnly ) {
253 'user_password' => $pwhash->toString(),
254 'user_password_expires' => $dbw->timestampOrNull( $expiry ),
263 return $this->loginOnly ? self::TYPE_NONE : self::TYPE_CREATE;
270 if ( !$this->loginOnly &&
$req &&
$req->username !== null &&
$req->password !== null ) {
271 if (
$req->password !==
$req->retype ) {
272 $ret->fatal(
'badretype' );
284 throw new \BadMethodCallException(
'Shouldn\'t call this when accountCreationType() is NONE' );
289 if (
$req->username !== null &&
$req->password !== null ) {
292 if (
$req->username !==
$user->getName() ) {
306 throw new \BadMethodCallException(
'Shouldn\'t call this when accountCreationType() is NONE' );
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.
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
static getCanonicalName($name, $validate= 'valid')
Given unvalidated user input, return a canonical username, or false if the username is invalid...
it s the revision text itself In either if gzip is the revision text is gzipped $flags
static newFatal($message)
Factory function for fatal errors.
wfTimestamp($outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
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
static newGood($value=null)
Factory function for good results.
static getDBOptions($bitfield)
Get an appropriate DB index and options for a query.
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
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
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
this hook is for auditing only $req
this hook is for auditing only or null if authentication failed before getting that far $username
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
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
const TS_UNIX
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.
wfTimestampOrNull($outputtype=TS_UNIX, $ts=null)
Return a formatted timestamp, or null if input is null.