From 3363ef97fcb3dae8ffaafac23bebfbb9db9ea731 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 2 Jul 2021 10:36:18 +0200 Subject: [PATCH] Add cancelLostPasswordRequest to UserAction --- .../files/lib/data/user/UserAction.class.php | 17 +++++++++++++++++ ...serLoginCancelLostPasswordListener.class.php | 11 +---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/wcfsetup/install/files/lib/data/user/UserAction.class.php b/wcfsetup/install/files/lib/data/user/UserAction.class.php index 2bb22707cd..a43fced14d 100644 --- a/wcfsetup/install/files/lib/data/user/UserAction.class.php +++ b/wcfsetup/install/files/lib/data/user/UserAction.class.php @@ -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' => '', + ]); + } + } } diff --git a/wcfsetup/install/files/lib/system/event/listener/UserLoginCancelLostPasswordListener.class.php b/wcfsetup/install/files/lib/system/event/listener/UserLoginCancelLostPasswordListener.class.php index 2ce062d429..606190fa45 100644 --- a/wcfsetup/install/files/lib/system/event/listener/UserLoginCancelLostPasswordListener.class.php +++ b/wcfsetup/install/files/lib/system/event/listener/UserLoginCancelLostPasswordListener.class.php @@ -23,15 +23,6 @@ final class UserLoginCancelLostPasswordListener return; } - (new UserAction( - [$user], - 'update', - [ - 'data' => [ - 'lastLostPasswordRequestTime' => 0, - 'lostPasswordKey' => '', - ], - ] - ))->executeAction(); + (new UserAction([$user], 'cancelLostPasswordRequest'))->executeAction(); } } -- 2.20.1