}
$status = $this->checkPasswordValidity( $username, $req->password );
- if ( !$status->isOk() ) {
+ if ( !$status->isOK() ) {
// Fatal, can't log in
return AuthenticationResponse::newFail( $status->getMessage() );
}
return $this->failResponse( $req );
}
+ // Add an extra log entry since a temporary password is
+ // an unusual way to log in, so its important to keep track
+ // of in case of abuse.
+ $this->logger->info( "{user} successfully logged in using temp password",
+ [
+ 'user' => $username,
+ 'requestIP' => $this->manager->getRequest()->getIP()
+ ]
+ );
+
$this->setPasswordResetFlag( $username, $status );
return AuthenticationResponse::newPass( $username );
$sv->merge( $this->checkPasswordValidity( $username, $req->password ) );
if ( $req->mailpassword ) {
- if ( !$this->emailEnabled && !$req->hasBackchannel ) {
+ if ( !$this->emailEnabled ) {
return \StatusValue::newFatal( 'passwordreset-emaildisabled' );
}
if ( $sendMail ) {
// Send email after DB commit
- $dbw->onTransactionIdle( function () use ( $req ) {
- /** @var TemporaryPasswordAuthenticationRequest $req */
- $this->sendPasswordResetEmail( $req );
- } );
+ $dbw->onTransactionIdle(
+ function () use ( $req ) {
+ /** @var TemporaryPasswordAuthenticationRequest $req */
+ $this->sendPasswordResetEmail( $req );
+ },
+ __METHOD__
+ );
}
}
$ret = \StatusValue::newGood();
if ( $req ) {
- if ( $req->mailpassword && !$req->hasBackchannel ) {
+ if ( $req->mailpassword ) {
if ( !$this->emailEnabled ) {
$ret->merge( \StatusValue::newFatal( 'emaildisabled' ) );
} elseif ( !$user->getEmail() ) {
if ( $mailpassword ) {
// Send email after DB commit
- wfGetDB( DB_MASTER )->onTransactionIdle( function () use ( $user, $creator, $req ) {
- $this->sendNewAccountEmail( $user, $creator, $req->password );
- } );
+ wfGetDB( DB_MASTER )->onTransactionIdle(
+ function () use ( $user, $creator, $req ) {
+ $this->sendNewAccountEmail( $user, $creator, $req->password );
+ },
+ __METHOD__
+ );
}
return $mailpassword ? 'byemail' : null;