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 }
This serves as the entry point to the authentication system.
PSR-3 logger instance factory.
Sends emails to all accounts associated with that email to reset the password.
__construct(AuthManager $authManager, array $reqs, array $logContext)
Interface that deferrable updates should implement.