From 201f388dee2f6fcd338f35ae573b0b342b47f784 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 17 Jul 2020 11:14:29 +0200 Subject: [PATCH] Form also uses ClientSecret now, so manually remove the registration at the end of the form too Signed-off-by: Joas Schilling --- lib/Controller/RegisterController.php | 3 +++ lib/Service/RegistrationService.php | 11 ----------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/lib/Controller/RegisterController.php b/lib/Controller/RegisterController.php index 94abb43..30994b0 100644 --- a/lib/Controller/RegisterController.php +++ b/lib/Controller/RegisterController.php @@ -227,6 +227,9 @@ class RegisterController extends Controller { return $this->showUserForm($secret, $token, $username, $exception->getMessage()); } + // Delete registration + $this->registrationService->deleteRegistration($registration); + if ($user->isEnabled()) { $this->registrationService->loginUser($user->getUID(), $user->getUID(), $password); diff --git a/lib/Service/RegistrationService.php b/lib/Service/RegistrationService.php index 2dfd3b3..a5c4c80 100644 --- a/lib/Service/RegistrationService.php +++ b/lib/Service/RegistrationService.php @@ -322,17 +322,6 @@ class RegistrationService { $user->setEnabled(false); } - // Delete pending registration if no client secret is stored - // with client secret implies registered via API - // without client secret implies registered via form - // if registered via API, the registration request will be deleted in apicontroller::status - if ($registration->getClientSecret() === null) { - $res = $this->registrationMapper->delete($registration); - if ($res === false) { - throw new RegistrationException($this->l10n->t('Failed to delete pending registration request')); - } - } - $this->mailService->notifyAdmins($userId, $user->isEnabled(), $groupId); return $user; }