MediaWiki master
SendPasswordResetEmailUpdate.php
Go to the documentation of this file.
1<?php
23namespace MediaWiki\Deferred;
24
27
34 private $authManager;
35
37 private $reqs;
38
40 private $logContext;
41
47 public function __construct( AuthManager $authManager, array $reqs, array $logContext ) {
48 $this->authManager = $authManager;
49 $this->reqs = $reqs;
50 $this->logContext = $logContext;
51 }
52
53 public function doUpdate() {
54 $logger = LoggerFactory::getInstance( 'authentication' );
55 foreach ( $this->reqs as $req ) {
56 // This is adding a new temporary password, not intentionally changing anything
57 // (even though it might technically invalidate an old temporary password).
58 $this->authManager->changeAuthenticationData( $req, /* $isAddition */ true );
59 $logger->info(
60 "{requestingUser} did password reset of {targetUser} and an email was sent",
61 $this->logContext + [ 'targetUser' => $req->username ]
62 );
63 }
64 }
65
66}
67
69class_alias( SendPasswordResetEmailUpdate::class, 'SendPasswordResetEmailUpdate' );
This serves as the entry point to the authentication system.
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.