diff --git a/app/Http/Controllers/Auth/RegisteredUserController.php b/app/Http/Controllers/Auth/RegisteredUserController.php index c32d9b2..eb0ffa0 100644 --- a/app/Http/Controllers/Auth/RegisteredUserController.php +++ b/app/Http/Controllers/Auth/RegisteredUserController.php @@ -13,6 +13,7 @@ use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Hash; use Illuminate\Validation\Rules; +use Illuminate\Validation\ValidationException; class RegisteredUserController extends Controller { @@ -50,7 +51,6 @@ public function store(Request $request) 'password' => Hash::make($request->password), ]); - event(new Registered($user)); $customer = new Customer(); $names = explode(" ", $user->name); @@ -58,13 +58,15 @@ public function store(Request $request) $customer->first_name = $names[0]; $customer->last_name = $names[1] ?? ''; $customer->save(); - + event(new Registered($user)); Auth::login($user); + } catch (\Exception $e) { DB::rollBack(); - return redirect()->back()->withInput()->with('error', 'Unable to register right now.'); + throw ValidationException::withMessages([ + 'email' => 'There was a problem during email sending. Please try to login with existing accounts', + ]); } - DB::commit(); Cart::moveCartItemsIntoDb(); diff --git a/backend/src/views/Login.vue b/backend/src/views/Login.vue index 003f56d..fc7a842 100644 --- a/backend/src/views/Login.vue +++ b/backend/src/views/Login.vue @@ -21,8 +21,17 @@ d="M6 18L18 6M6 6l12 12" /> - + + +
+Email: admin@example.com +Password: admin123 ++
+Email: user1@example.com +Password: useruser1 + +Email: user2@example.com +Password: useruser2+