diff --git a/app/Actions/Fortify/CreateNewUser.php b/app/Actions/Fortify/CreateNewUser.php index 6eb29f7..b098ab2 100644 --- a/app/Actions/Fortify/CreateNewUser.php +++ b/app/Actions/Fortify/CreateNewUser.php @@ -2,11 +2,14 @@ namespace App\Actions\Fortify; +use A6digital\Image\DefaultProfileImage; use App\Models\User; use Illuminate\Support\Facades\Hash; +use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Validator; use Illuminate\Validation\Rule; use Laravel\Fortify\Contracts\CreatesNewUsers; +use function mb_substr; class CreateNewUser implements CreatesNewUsers { @@ -34,12 +37,15 @@ class CreateNewUser implements CreatesNewUsers 'password' => $this->passwordRules(), ])->validate(); + $profileImageURL = 'https://ui-avatars.com/api/?name=' . mb_substr($input['first_name'],0,1) . '+' . mb_substr($input['last_name'],0,1); + return User::create([ 'first_name' => $input['first_name'], 'last_name' => $input['last_name'], 'judging_preference' => $input['judging_preference'], 'cell_phone' => $input['cell_phone'], 'email' => $input['email'], + 'profile_image_url' => $profileImageURL, 'password' => Hash::make($input['password']), ]); } diff --git a/app/Actions/Fortify/UpdateUserPassword.php b/app/Actions/Fortify/UpdateUserPassword.php index 7005639..8ce1488 100644 --- a/app/Actions/Fortify/UpdateUserPassword.php +++ b/app/Actions/Fortify/UpdateUserPassword.php @@ -23,7 +23,7 @@ class UpdateUserPassword implements UpdatesUserPasswords 'password' => $this->passwordRules(), ], [ 'current_password.current_password' => __('The provided password does not match your current password.'), - ])->validateWithBag('updatePassword'); + ])->validate(); $user->forceFill([ 'password' => Hash::make($input['password']), diff --git a/app/Actions/Fortify/UpdateUserProfileInformation.php b/app/Actions/Fortify/UpdateUserProfileInformation.php index 05c1f85..1ed1c7b 100644 --- a/app/Actions/Fortify/UpdateUserProfileInformation.php +++ b/app/Actions/Fortify/UpdateUserProfileInformation.php @@ -30,7 +30,7 @@ class UpdateUserProfileInformation implements UpdatesUserProfileInformation 'max:255', Rule::unique('users')->ignore($user->id), ], - ])->validateWithBag('updateProfileInformation'); + ])->validate(); if ($input['email'] !== $user->email && $user instanceof MustVerifyEmail) { diff --git a/app/Models/User.php b/app/Models/User.php index 02bd294..2c2a366 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -24,6 +24,7 @@ class User extends Authenticatable implements MustVerifyEmail 'cell_phone', 'email', 'password', + 'profile_image_url' ]; /** diff --git a/database/migrations/0001_01_01_000000_create_users_table.php b/database/migrations/0001_01_01_000000_create_users_table.php index e9d9d50..8bf67b9 100644 --- a/database/migrations/0001_01_01_000000_create_users_table.php +++ b/database/migrations/0001_01_01_000000_create_users_table.php @@ -20,6 +20,7 @@ return new class extends Migration $table->string('email')->unique(); $table->timestamp('email_verified_at')->nullable(); $table->string('password'); + $table->string('profile_image_url')->nullable(); $table->rememberToken(); $table->timestamps(); }); diff --git a/resources/views/components/auth/form-button-nocolor.blade.php b/resources/views/components/auth/form-button-nocolor.blade.php new file mode 100644 index 0000000..98830a4 --- /dev/null +++ b/resources/views/components/auth/form-button-nocolor.blade.php @@ -0,0 +1,6 @@ +@php + $buttonClasses = "text-sm font-semibold leading-6 text-gray-900"; +@endphp +
+ +
diff --git a/resources/views/components/auth/form-card.blade.php b/resources/views/components/auth/form-card.blade.php new file mode 100644 index 0000000..ecfc39b --- /dev/null +++ b/resources/views/components/auth/form-card.blade.php @@ -0,0 +1,29 @@ +@props([ + 'breakpoint' => 'sm', + 'cols' => '6', + 'method' => 'POST', + 'action' => '#', + 'buttons' => false, + 'submitButtonText' => 'Submit' +]) +
+
+
+ @csrf + @if($method != 'POST' AND $method != 'GET') + @method($method) + @endif + {{ $slot }} +
+
+
+ @if($buttons) + {{ $buttons }} + @else + Cancel + {{ $submitButtonText }} + @endif + {{ $buttons }} + +
+
diff --git a/resources/views/components/layout/navbar.blade.php b/resources/views/components/layout/navbar.blade.php index 8c48feb..62c2aa2 100644 --- a/resources/views/components/layout/navbar.blade.php +++ b/resources/views/components/layout/navbar.blade.php @@ -1,3 +1,4 @@ +@php use Illuminate\Support\Facades\Auth; @endphp