30use Wikimedia\Assert\Assert;
45 private $passwordFactory =
null;
54 $this->authoritative = !isset( $params[
'authoritative'] ) || (bool)$params[
'authoritative'];
61 if ( $this->passwordFactory ===
null ) {
67 return $this->passwordFactory;
78 return $passwordFactory->newFromCiphertext( $hash );
80 $class = static::class;
81 $this->logger->debug(
"Invalid password hash in {$class}::getPassword()" );
82 return $passwordFactory->newFromCiphertext(
null );
92 if ( $this->authoritative ) {
94 wfMessage( $req->password ===
'' ?
'wrongpasswordempty' :
'wrongpassword' )
112 return User::newFromName( $username )->checkPasswordValidity( $password );
127 Assert::precondition( !$status->isOK(), __METHOD__ .
' expects a fatal Status' );
129 ->getFullURL( [
'wpUsername' => $username ] );
146 $reset = $this->getPasswordResetData( $username, $data );
150 $hard = $status->
getValue()[
'forceChange'] ??
false;
152 if ( $hard || !empty( $status->
getValue()[
'suggestChangeOnLogin'] ) ) {
154 'msg' => $status->
getMessage( $hard ?
'resetpass-validity' :
'resetpass-validity-soft' ),
161 $this->manager->setAuthenticationSessionData(
'reset-pass', $reset );
186 $expires = $days ?
wfTimestamp( TS_MW, time() + $days * 86400 ) :
null;
189 $this->getHookRunner()->onResetPasswordExpiration(
190 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,...
Show an error when any operation involving passwords fails to run.
Factory class for creating and checking Password objects.
Represents a password hash for use in authentication.
isGood()
Returns whether the operation completed and didn't have any error or warnings.