47 $this->authoritative = !isset( $params[
'authoritative'] ) || (bool)$params[
'authoritative'];
55 if ( $this->passwordFactory ===
null ) {
57 $this->config->get(
'PasswordConfig' ),
58 $this->config->get(
'PasswordDefault' )
74 $class = static::class;
75 $this->logger->debug(
"Invalid password hash in {$class}::getPassword()" );
86 if ( $this->authoritative ) {
88 wfMessage( $req->password ===
'' ?
'wrongpasswordempty' :
'wrongpassword' )
106 return \User::newFromName( $username )->checkPasswordValidity( $password );
123 if ( !$reset && $this->config->get(
'InvalidPasswordReset' ) && !$status->
isGood() ) {
124 $hard = $status->
getValue()[
'forceChange'] ??
false;
126 if ( $hard || !empty( $status->
getValue()[
'suggestChangeOnLogin'] ) ) {
128 'msg' => $status->
getMessage( $hard ?
'resetpass-validity' :
'resetpass-validity-soft' ),
135 $this->manager->setAuthenticationSessionData(
'reset-pass', $reset );
157 $days = $this->config->get(
'PasswordExpirationDays' );
158 $expires = $days ?
wfTimestamp( TS_MW, time() + $days * 86400 ) :
null;
161 \Hooks::run(
'ResetPasswordExpiration', [ \
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.
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.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
getMessage( $shortContext=false, $longContext=false, $lang=null)
Get a bullet list of the errors as a Message object.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.