diff --git a/composer.json b/composer.json index 24e6583..fb092e6 100644 --- a/composer.json +++ b/composer.json @@ -22,8 +22,9 @@ ], "require": { "php": "^7.3|^8.0", - "illuminate/filesystem": "^8.0", - "illuminate/support": "^8.0" + "illuminate/filesystem": "^8.40", + "illuminate/support": "^8.40", + "illuminate/validation": "^8.40" }, "autoload": { "psr-4": { diff --git a/stubs/inertia/app/Http/Controllers/Auth/NewPasswordController.php b/stubs/inertia/app/Http/Controllers/Auth/NewPasswordController.php index 78b72dd..4bd5b32 100644 --- a/stubs/inertia/app/Http/Controllers/Auth/NewPasswordController.php +++ b/stubs/inertia/app/Http/Controllers/Auth/NewPasswordController.php @@ -8,6 +8,7 @@ use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Password; use Illuminate\Support\Str; +use Illuminate\Validation\Rules; use Illuminate\Validation\ValidationException; use Inertia\Inertia; @@ -40,7 +41,7 @@ public function store(Request $request) $request->validate([ 'token' => 'required', 'email' => 'required|email', - 'password' => 'required|string|confirmed|min:8', + 'password' => ['required', 'confirmed', Rules\Password::min(8)], ]); // Here we will attempt to reset the user's password. If it is successful we diff --git a/stubs/inertia/app/Http/Controllers/Auth/RegisteredUserController.php b/stubs/inertia/app/Http/Controllers/Auth/RegisteredUserController.php index f122d9b..008b4a5 100644 --- a/stubs/inertia/app/Http/Controllers/Auth/RegisteredUserController.php +++ b/stubs/inertia/app/Http/Controllers/Auth/RegisteredUserController.php @@ -9,6 +9,7 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Hash; +use Illuminate\Validation\Rules; use Inertia\Inertia; class RegisteredUserController extends Controller @@ -36,7 +37,7 @@ public function store(Request $request) $request->validate([ 'name' => 'required|string|max:255', 'email' => 'required|string|email|max:255|unique:users', - 'password' => 'required|string|confirmed|min:8', + 'password' => ['required', 'confirmed', Rules\Password::min(8)], ]); $user = User::create([ diff --git a/stubs/inertia/resources/js/Components/Forms/TextInput.js b/stubs/inertia/resources/js/Components/Forms/TextInput.js index 5752d03..f33e359 100644 --- a/stubs/inertia/resources/js/Components/Forms/TextInput.js +++ b/stubs/inertia/resources/js/Components/Forms/TextInput.js @@ -1,6 +1,6 @@ import React, { useEffect, useRef } from "react"; -export default function TextInput({ label, type = 'text', name, value, handleChange, autoComplete, isFocused }) { +export default function TextInput({ label, type = 'text', name, value, error, handleChange, autoComplete, isFocused }) { const input = useRef(); @@ -16,13 +16,15 @@ export default function TextInput({ label, type = 'text', name, value, handleCha handleChange(e)} ref={input} autoComplete={autoComplete} required /> + + {error &&
{error}
} ); } diff --git a/stubs/inertia/resources/js/Pages/Auth/ConfirmPassword.js b/stubs/inertia/resources/js/Pages/Auth/ConfirmPassword.js index d7bba99..22abf05 100644 --- a/stubs/inertia/resources/js/Pages/Auth/ConfirmPassword.js +++ b/stubs/inertia/resources/js/Pages/Auth/ConfirmPassword.js @@ -38,6 +38,7 @@ export default function ConfirmPassword() {