MediaWiki master
SendPasswordResetEmailUpdate.php
Go to the documentation of this file.
1<?php
9namespace MediaWiki\Deferred;
10
13
20 private $authManager;
21
23 private $reqs;
24
26 private $logContext;
27
33 public function __construct( AuthManager $authManager, array $reqs, array $logContext ) {
34 $this->authManager = $authManager;
35 $this->reqs = $reqs;
36 $this->logContext = $logContext;
37 }
38
39 public function doUpdate() {
40 $logger = LoggerFactory::getInstance( 'authentication' );
41 foreach ( $this->reqs as $req ) {
42 // This is adding a new temporary password, not intentionally changing anything
43 // (even though it might technically invalidate an old temporary password).
44 $this->authManager->changeAuthenticationData( $req, /* $isAddition */ true );
45 $logger->info(
46 "{requestingUser} did password reset of {targetUser} and an email was sent",
47 $this->logContext + [ 'targetUser' => $req->username ]
48 );
49 }
50 }
51
52}
53
55class_alias( SendPasswordResetEmailUpdate::class, 'SendPasswordResetEmailUpdate' );
AuthManager is the authentication system in MediaWiki and serves entry point for authentication.
Sends emails to all accounts associated with that email to reset the password.
__construct(AuthManager $authManager, array $reqs, array $logContext)
Create PSR-3 logger objects.
Interface that deferrable updates should implement.