MediaWiki  master
SendPasswordResetEmailUpdate.php
Go to the documentation of this file.
1 <?php
25 
32  private $authManager;
33 
35  private $reqs;
36 
38  private $logContext;
39 
45  public function __construct( AuthManager $authManager, array $reqs, array $logContext ) {
46  $this->authManager = $authManager;
47  $this->reqs = $reqs;
48  $this->logContext = $logContext;
49  }
50 
51  public function doUpdate() {
52  $logger = LoggerFactory::getInstance( 'authentication' );
53  foreach ( $this->reqs as $req ) {
54  // This is adding a new temporary password, not intentionally changing anything
55  // (even though it might technically invalidate an old temporary password).
56  $this->authManager->changeAuthenticationData( $req, /* $isAddition */ true );
57  $logger->info(
58  "{requestingUser} did password reset of {targetUser} and an email was sent",
59  $this->logContext + [ 'targetUser' => $req->username ]
60  );
61  }
62  }
63 
64 }
MediaWiki\Logger\LoggerFactory
PSR-3 logger instance factory.
Definition: LoggerFactory.php:45
SendPasswordResetEmailUpdate
Sends emails to all accounts associated with that email to reset the password.
Definition: SendPasswordResetEmailUpdate.php:30
SendPasswordResetEmailUpdate\__construct
__construct(AuthManager $authManager, array $reqs, array $logContext)
Definition: SendPasswordResetEmailUpdate.php:45
SendPasswordResetEmailUpdate\$logContext
array $logContext
Definition: SendPasswordResetEmailUpdate.php:38
SendPasswordResetEmailUpdate\doUpdate
doUpdate()
Perform the actual work.
Definition: SendPasswordResetEmailUpdate.php:51
SendPasswordResetEmailUpdate\$authManager
AuthManager $authManager
Definition: SendPasswordResetEmailUpdate.php:32
MediaWiki\Auth\AuthManager
This serves as the entry point to the authentication system.
Definition: AuthManager.php:88
SendPasswordResetEmailUpdate\$reqs
array $reqs
Definition: SendPasswordResetEmailUpdate.php:35
DeferrableUpdate
Interface that deferrable updates should implement.
Definition: DeferrableUpdate.php:11