return AuthenticationResponse::newAbstain();
}
- $dbw = wfGetDB( DB_MASTER );
- $row = $dbw->selectRow(
+ $dbr = wfGetDB( DB_REPLICA );
+ $row = $dbr->selectRow(
'user',
[
'user_id', 'user_newpassword', 'user_newpass_time',
}
$status = $this->checkPasswordValidity( $username, $req->password );
- if ( !$status->isOk() ) {
+ if ( !$status->isOK() ) {
// Fatal, can't log in
return AuthenticationResponse::newFail( $status->getMessage() );
}
return false;
}
- $dbw = wfGetDB( DB_MASTER );
- $row = $dbw->selectRow(
+ $dbr = wfGetDB( DB_REPLICA );
+ $row = $dbr->selectRow(
'user',
[ 'user_newpassword', 'user_newpass_time' ],
[ 'user_name' => $username ],
);
if ( $sendMail ) {
- $this->sendPasswordResetEmail( $req );
+ // Send email after DB commit
+ $dbw->onTransactionIdle(
+ function () use ( $req ) {
+ /** @var TemporaryPasswordAuthenticationRequest $req */
+ $this->sendPasswordResetEmail( $req );
+ },
+ __METHOD__
+ );
}
}
$this->providerChangeAuthenticationData( $req );
if ( $mailpassword ) {
- $this->sendNewAccountEmail( $user, $creator, $req->password );
+ // Send email after DB commit
+ wfGetDB( DB_MASTER )->onTransactionIdle(
+ function () use ( $user, $creator, $req ) {
+ $this->sendNewAccountEmail( $user, $creator, $req->password );
+ },
+ __METHOD__
+ );
}
return $mailpassword ? 'byemail' : null;