16use Wikimedia\Assert\Assert;
17use Wikimedia\Timestamp\TimestampFormat as TS;
33 private $passwordFactory =
null;
42 $this->authoritative = !isset( $params[
'authoritative'] ) || (bool)$params[
'authoritative'];
49 if ( $this->passwordFactory ===
null ) {
55 return $this->passwordFactory;
68 $class = static::class;
69 $this->logger->debug(
"Invalid password hash in {$class}::getPassword()" );
80 if ( $this->authoritative ) {
82 wfMessage( $req->password ===
'' ?
'wrongpasswordempty' :
'wrongpassword' )
100 return User::newFromName( $username )->checkPasswordValidity( $password );
115 Assert::precondition( !$status->isOK(), __METHOD__ .
' expects a fatal Status' );
117 ->getFullURL( [
'wpUsername' => $username ] );
134 $reset = $this->getPasswordResetData( $username, $data );
138 $hard = $status->
getValue()[
'forceChange'] ??
false;
140 if ( $hard || !empty( $status->
getValue()[
'suggestChangeOnLogin'] ) ) {
142 'msg' => $status->
getMessage( $hard ?
'resetpass-validity' :
'resetpass-validity-soft' ),
149 $this->manager->setAuthenticationSessionData(
'reset-pass', $reset );
174 $expires = $days ?
wfTimestamp( TS::MW, time() + $days * 86400 ) :
null;
177 $this->getHookRunner()->onResetPasswordExpiration(
178 User::newFromName( $username ), $expires );
wfTimestamp( $outputtype=TS::UNIX, $ts=0)
Get a timestamp string in one of various formats.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
A class containing constants representing the names of configuration variables.
const PasswordExpirationDays
Name constant for the PasswordExpirationDays setting, for use with Config::get()
const PasswordDefault
Name constant for the PasswordDefault setting, for use with Config::get()
const PasswordConfig
Name constant for the PasswordConfig setting, for use with Config::get()
const InvalidPasswordReset
Name constant for the InvalidPasswordReset setting, for use with Config::get()
Parent class for all special pages.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
isGood()
Returns whether the operation completed and didn't have any error or warnings.