diff --git a/app/Http/Controllers/Auth/RegisteredUserController.php b/app/Http/Controllers/Auth/RegisteredUserController.php index d8d29eb5..208d9a24 100644 --- a/app/Http/Controllers/Auth/RegisteredUserController.php +++ b/app/Http/Controllers/Auth/RegisteredUserController.php @@ -37,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', 'confirmed', Rules\Password::defaults()], + 'password' => ['required', 'confirmed', Rules\Password::min(8)->letters()], ]); $user = User::create([ diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index e0093a49..56b1bd54 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers; use App\Http\Requests\ProfileUpdateRequest; +use Illuminate\Support\Facades\Hash; class ProfileController extends Controller { @@ -13,6 +14,16 @@ public function show() public function update(ProfileUpdateRequest $request) { + $user = auth()->user(); + + $user->name = $request->name; + $user->email = $request->email; + + if ($request->filled('password')) { + $user->password = Hash::make($request->input('password')); + } + + $user->save(); // Task: fill in the code here to update name and email // Also, update the password if it is set diff --git a/app/Models/User.php b/app/Models/User.php index e23e0905..12a2354b 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -8,7 +8,7 @@ use Illuminate\Notifications\Notifiable; use Laravel\Sanctum\HasApiTokens; -class User extends Authenticatable +class User extends Authenticatable implements MustVerifyEmail { use HasApiTokens, HasFactory, Notifiable; diff --git a/resources/views/auth/profile.blade.php b/resources/views/auth/profile.blade.php index 70e8a8e1..f90440d8 100644 --- a/resources/views/auth/profile.blade.php +++ b/resources/views/auth/profile.blade.php @@ -10,7 +10,7 @@
- + @@ -22,44 +22,31 @@ Task: replace ??? for name/email with logged in user's name/email

- + {{-- Task: replace ??? for name/email with logged in user's name/email --}} - +
- + - +
- + - +
- + - +
diff --git a/resources/views/layouts/navigation.blade.php b/resources/views/layouts/navigation.blade.php index 785936e7..99014ca4 100644 --- a/resources/views/layouts/navigation.blade.php +++ b/resources/views/layouts/navigation.blade.php @@ -6,7 +6,7 @@ @@ -16,49 +16,53 @@ {{ __('Users') }} {{-- Task: this "Profile" link should be visible only to logged-in users --}} - - {{ __('Profile') }} - + @auth + + {{ __('Profile') }} + + @endauth
@@ -66,13 +70,13 @@ class="flex items-center text-sm font-medium text-gray-500 transition duration-1
@@ -80,38 +84,39 @@ class="inline-flex justify-center items-center p-2 text-gray-400 rounded-md tran -