]> BookStack Code Mirror - bookstack/blobdiff - app/Auth/Access/RegistrationService.php
Prevented email confirmation exception throw on registration
[bookstack] / app / Auth / Access / RegistrationService.php
index 9136b37b5a86ea49f1f0a8ccaac27b1fd25eb27d..00ad630be23dd2cba644e679870d924c44dc721e 100644 (file)
@@ -71,15 +71,14 @@ class RegistrationService
         // Start email confirmation flow if required
         if ($this->emailConfirmationService->confirmationRequired() && !$emailConfirmed) {
             $newUser->save();
-            $message = '';
 
             try {
                 $this->emailConfirmationService->sendConfirmation($newUser);
             } catch (Exception $e) {
                 $message = trans('auth.email_confirm_send_error');
+                throw new UserRegistrationException($message, '/register/confirm');
             }
 
-            throw new UserRegistrationException($message, '/register/confirm');
         }
 
         return $newUser;