31use Wikimedia\Assert\Assert;
46 private $passwordFactory =
null;
55 $this->authoritative = !isset(
$params[
'authoritative'] ) || (bool)
$params[
'authoritative'];
62 if ( $this->passwordFactory ===
null ) {
68 return $this->passwordFactory;
79 return $passwordFactory->newFromCiphertext( $hash );
81 $class = static::class;
82 $this->logger->debug(
"Invalid password hash in {$class}::getPassword()" );
83 return $passwordFactory->newFromCiphertext(
null );
93 if ( $this->authoritative ) {
95 wfMessage( $req->password ===
'' ?
'wrongpasswordempty' :
'wrongpassword' )
113 return User::newFromName( $username )->checkPasswordValidity( $password );
128 Assert::precondition( !$status->isOK(), __METHOD__ .
' expects a fatal Status' );
130 ->getFullURL( [
'wpUsername' => $username ] );
147 $reset = $this->getPasswordResetData( $username, $data );
151 $hard = $status->
getValue()[
'forceChange'] ??
false;
153 if ( $hard || !empty( $status->
getValue()[
'suggestChangeOnLogin'] ) ) {
155 'msg' => $status->
getMessage( $hard ?
'resetpass-validity' :
'resetpass-validity-soft' ),
162 $this->manager->setAuthenticationSessionData(
'reset-pass', $reset );
187 $expires = $days ?
wfTimestamp( TS_MW, time() + $days * 86400 ) :
null;
190 $this->getHookRunner()->onResetPasswordExpiration(
191 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.
array $params
The job parameters.
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.