X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/87a5340a0526d4f46d4da676ce44f4e26039d281..refs/pull/2522/head:/app/Auth/Access/RegistrationService.php diff --git a/app/Auth/Access/RegistrationService.php b/app/Auth/Access/RegistrationService.php index 00ad630be..2aff6c37d 100644 --- a/app/Auth/Access/RegistrationService.php +++ b/app/Auth/Access/RegistrationService.php @@ -1,9 +1,11 @@ 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,12 +70,15 @@ class RegistrationService $newUser->socialAccounts()->save($socialAccount); } + Activity::add(ActivityType::AUTH_REGISTER, $socialAccount ?? $newUser); + // Start email confirmation flow if required if ($this->emailConfirmationService->confirmationRequired() && !$emailConfirmed) { $newUser->save(); try { $this->emailConfirmationService->sendConfirmation($newUser); + session()->flash('sent-email-confirmation', true); } catch (Exception $e) { $message = trans('auth.email_confirm_send_error'); throw new UserRegistrationException($message, '/register/confirm');