Browse Source

Fixed errors appearing multiple times

1day2die 3 years ago
parent
commit
7b974c17d2

+ 3 - 1
app/Http/Controllers/Auth/RegisterController.php

@@ -109,7 +109,9 @@ class RegisterController extends Controller
 
 
         if ($response->failed()) {
         if ($response->failed()) {
             $user->delete();
             $user->delete();
-            throw ValidationException::withMessages([__('Account already exists on Pterodactyl. Please contact the Support!')]);
+            throw ValidationException::withMessages([
+                'ptero' => [__('Account already exists on Pterodactyl. Please contact the Support!')],
+            ]);
         }
         }
 
 
         $user->update([
         $user->update([

+ 7 - 6
resources/views/auth/register.blade.php

@@ -23,12 +23,13 @@
                                 <small><strong>{{ $message }}</strong></small>
                                 <small><strong>{{ $message }}</strong></small>
                             </span>
                             </span>
                     @enderror
                     @enderror
-                    @foreach ($errors->all() as $error)
-                        <span class="text-danger" role="alert">
-                                <small><strong>{!! $errors->first() !!}</strong></small>
-                            </span>
-
-                    @endforeach
+                    @if( $errors->has('ptero') )
+                        @foreach( $errors->get('ptero') as $err )
+                            <span class="text-danger" role="alert">
+                                 <small><strong>{{ $err }}</strong></small>
+                           </span>
+                        @endforeach
+                    @endif
 
 
                     @csrf
                     @csrf
                     <div class="form-group">
                     <div class="form-group">