Optimize email sending on password reset
[lhc/web/wiklou.git] / includes / user / PasswordReset.php
index a1638ea..73e5cbc 100644 (file)
@@ -226,7 +226,6 @@ class PasswordReset implements LoggerAwareInterface {
                        'requestingUser' => $performingUser->getName(),
                        'targetUsername' => $username,
                        'targetEmail' => $email,
-                       'actualUser' => $firstUser->getName(),
                ];
 
                if ( !$result->isGood() ) {
@@ -237,15 +236,9 @@ class PasswordReset implements LoggerAwareInterface {
                        return $result;
                }
 
-               foreach ( $reqs as $req ) {
-                       // This is adding a new temporary password, not intentionally changing anything
-                       // (even though it might technically invalidate an old temporary password).
-                       $this->authManager->changeAuthenticationData( $req, /* $isAddition */ true );
-               }
-
-               $this->logger->info(
-                       "{requestingUser} did password reset of {actualUser}",
-                       $logContext
+               DeferredUpdates::addUpdate(
+                       new SendPasswordResetEmailUpdate( $this->authManager, $reqs, $logContext ),
+                       DeferredUpdates::POSTSEND
                );
 
                return StatusValue::newGood();