X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/1f9704779919a2e094c17e8f556ec9cc92ac437b..refs/pull/2734/head:/app/Auth/Access/RegistrationService.php diff --git a/app/Auth/Access/RegistrationService.php b/app/Auth/Access/RegistrationService.php index b85f7ffd8..68b17771d 100644 --- a/app/Auth/Access/RegistrationService.php +++ b/app/Auth/Access/RegistrationService.php @@ -1,9 +1,13 @@ userRepo->getByEmail($userEmail)); if ($alreadyUser) { - throw new UserRegistrationException(trans('errors.error_user_exists_different_creds', ['email' => $userEmail])); + throw new UserRegistrationException(trans('errors.error_user_exists_different_creds', ['email' => $userEmail]), '/login'); } // Create the user @@ -68,6 +72,9 @@ class RegistrationService $newUser->socialAccounts()->save($socialAccount); } + Activity::add(ActivityType::AUTH_REGISTER, $socialAccount ?? $newUser); + Theme::dispatch(ThemeEvents::AUTH_REGISTER, $socialAccount ? $socialAccount->driver : auth()->getDefaultDriver(), $newUser); + // Start email confirmation flow if required if ($this->emailConfirmationService->confirmationRequired() && !$emailConfirmed) { $newUser->save(); @@ -79,7 +86,6 @@ class RegistrationService $message = trans('auth.email_confirm_send_error'); throw new UserRegistrationException($message, '/register/confirm'); } - } return $newUser; @@ -105,5 +111,4 @@ class RegistrationService throw new UserRegistrationException(trans('auth.registration_email_domain_invalid'), $redirect); } } - -} \ No newline at end of file +}