* @ingroup SpecialPage
*/
+use MediaWiki\Logger\LoggerFactory;
+
/**
* Let users manage bot passwords
*
/** @var string New password set, for communication between onSubmit() and onSuccess() */
private $password = null;
+ /** @var Psr\Log\LoggerInterface */
+ private $logger = null;
+
public function __construct() {
parent::__construct( 'BotPasswords', 'editmyprivateinfo' );
+ $this->logger = LoggerFactory::getInstance( 'authentication' );
}
/**
$bp = BotPassword::newFromCentralId( $this->userId, $this->par );
if ( $bp ) {
$bp->delete();
+ $this->logger->info(
+ "Bot password {op} for {user}@{app_id}",
+ [
+ 'app_id' => $this->par,
+ 'user' => $this->getUser()->getName(),
+ 'centralId' => $this->userId,
+ 'op' => 'delete',
+ 'client_ip' => $this->getRequest()->getIP()
+ ]
+ );
}
return Status::newGood();
}
if ( $bp->save( $this->operation, $password ) ) {
+ $this->logger->info(
+ "Bot password {op} for {user}@{app_id}",
+ [
+ 'op' => $this->operation,
+ 'user' => $this->getUser()->getName(),
+ 'app_id' => $this->par,
+ 'centralId' => $this->userId,
+ 'restrictions' => $data['restrictions'],
+ 'grants' => $bp->getGrants(),
+ 'client_ip' => $this->getRequest()->getIP()
+ ]
+ );
return Status::newGood();
} else {
// Messages: botpasswords-insert-failed, botpasswords-update-failed