Forráskód Böngészése

populate registration form with entered data on return from failed validation.

tyson 1 éve
szülő
commit
d205411f47

+ 1 - 1
app/Http/Controllers/AuthController.php

@@ -26,6 +26,6 @@ class AuthController extends Controller
             'email' => $validated['email'],
             'password' => Hash::make($validated['password'])
         ]);
-        return redirect()->route('ideas.index')->with('success', 'Registration successful!');
+        return redirect()->route('ideas.index')->with('success', 'Registration successful!')->withInput();
     }
 }

+ 2 - 2
resources/views/auth/register.blade.php

@@ -8,14 +8,14 @@
                 <h3 class="text-center text-dark">Register</h3>
                 <div class="form-group">
                     <label for="name" class="text-dark">Name:</label><br>
-                    <input type="text" name="name" id="name" class="form-control" value="{{request('name')}}">
+                    <input type="text" name="name" id="name" class="form-control" value="{{request()->old('name')}}">
                     @error('name')
                     <span class="d-block fs-2 text-danger mt-2">{{$message}}</span>
                     @enderror
                 </div>
                 <div class="form-group mt-3">
                     <label for="email" class="text-dark">Email:</label><br>
-                    <input type="email" name="email" id="email" class="form-control" value="{{request('email')}}">
+                    <input type="email" name="email" id="email" class="form-control" value="{{request()->old('email')}}">
                     @error('email')
                     <span class="d-block fs-2 text-danger mt-2">{{$message}}</span>
                     @enderror