Add cancelLostPasswordRequest to UserAction
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 2 Jul 2021 08:36:18 +0000 (10:36 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 2 Jul 2021 09:24:51 +0000 (11:24 +0200)
wcfsetup/install/files/lib/data/user/UserAction.class.php
wcfsetup/install/files/lib/system/event/listener/UserLoginCancelLostPasswordListener.class.php

index 2bb22707cddfe24e3a598bb6673d473807835218..a43fced14d9e65503198ac16741154c4471dadaf 100644 (file)
@@ -1235,4 +1235,21 @@ class UserAction extends AbstractDatabaseObjectAction implements IClipboardActio
             'languageID' => $this->parameters['languageID'],
         ]);
     }
+
+    /**
+     * @since   5.5
+     */
+    public function cancelLostPasswordRequest(): void
+    {
+        if (empty($this->objects)) {
+            $this->readObjects();
+        }
+
+        foreach ($this->getObjects() as $userEditor) {
+            $userEditor->update([
+                'lastLostPasswordRequestTime' => 0,
+                'lostPasswordKey' => '',
+            ]);
+        }
+    }
 }
index 2ce062d429b2ce79fd144b6ba68cdb62057ee628..606190fa45b609caa6af11dc73269299de3f1847 100644 (file)
@@ -23,15 +23,6 @@ final class UserLoginCancelLostPasswordListener
             return;
         }
 
-        (new UserAction(
-            [$user],
-            'update',
-            [
-                'data' => [
-                    'lastLostPasswordRequestTime' => 0,
-                    'lostPasswordKey' => '',
-                ],
-            ]
-        ))->executeAction();
+        (new UserAction([$user], 'cancelLostPasswordRequest'))->executeAction();
     }
 }