diff --git a/app/Actions/Fortify/CreateNewUser.php b/app/Actions/Fortify/CreateNewUser.php index a9f1653..4fdeedb 100644 --- a/app/Actions/Fortify/CreateNewUser.php +++ b/app/Actions/Fortify/CreateNewUser.php @@ -23,13 +23,15 @@ class CreateNewUser implements CreatesNewUsers Validator::make($input, [ 'name' => ['required', 'string', 'max:255'], 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], + 'username' => ['required', 'string', 'max:255', 'unique:users'], 'password' => $this->passwordRules(), 'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature() ? ['accepted', 'required'] : '', ])->validate(); return User::create([ - 'name' => $input['name'], - 'email' => $input['email'], + 'name' => mb_strtolower($input['name']), + 'email' => mb_strtolower($input['email']), + 'username' => mb_strtolower($input['username']), 'password' => Hash::make($input['password']), ]); } diff --git a/app/Actions/Fortify/UpdateUserProfileInformation.php b/app/Actions/Fortify/UpdateUserProfileInformation.php index c757632..79a7b8a 100644 --- a/app/Actions/Fortify/UpdateUserProfileInformation.php +++ b/app/Actions/Fortify/UpdateUserProfileInformation.php @@ -21,6 +21,7 @@ class UpdateUserProfileInformation implements UpdatesUserProfileInformation Validator::make($input, [ 'name' => ['required', 'string', 'max:255'], 'email' => ['required', 'email', 'max:255', Rule::unique('users')->ignore($user->id)], + 'username' => ['required', 'max:255', Rule::unique('users')->ignore($user->id)], 'photo' => ['nullable', 'mimes:jpg,jpeg,png', 'max:1024'], ])->validateWithBag('updateProfileInformation'); @@ -33,8 +34,9 @@ class UpdateUserProfileInformation implements UpdatesUserProfileInformation $this->updateVerifiedUser($user, $input); } else { $user->forceFill([ - 'name' => $input['name'], - 'email' => $input['email'], + 'name' => mb_strtolower($input['name']), + 'email' => mb_strtolower($input['email']), + 'username' => mb_strtolower($input['username']), ])->save(); } } diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 52dabc1..1d9865b 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -17,7 +17,7 @@ class RouteServiceProvider extends ServiceProvider * * @var string */ - public const HOME = '/dashboard'; + public const HOME = '/'; /** * Define your route model bindings, pattern filters, and other route configuration. diff --git a/config/fortify.php b/config/fortify.php index 510a539..99371b7 100644 --- a/config/fortify.php +++ b/config/fortify.php @@ -46,7 +46,7 @@ return [ | */ - 'username' => 'email', + 'username' => 'username', 'email' => 'email', diff --git a/config/jetstream.php b/config/jetstream.php index a90b5a0..df36416 100644 --- a/config/jetstream.php +++ b/config/jetstream.php @@ -59,7 +59,7 @@ return [ 'features' => [ // Features::termsAndPrivacyPolicy(), - // Features::profilePhotos(), + Features::profilePhotos(), // Features::api(), // Features::teams(['invitations' => true]), Features::accountDeletion(), diff --git a/database/migrations/2022_07_15_060249_add_username_column_to_users_table.php b/database/migrations/2022_07_15_060249_add_username_column_to_users_table.php index 5c2610e..b65a919 100644 --- a/database/migrations/2022_07_15_060249_add_username_column_to_users_table.php +++ b/database/migrations/2022_07_15_060249_add_username_column_to_users_table.php @@ -14,7 +14,9 @@ return new class extends Migration public function up() { Schema::table('users', function (Blueprint $table) { - // + $table->after('name', function (Blueprint $table) { + $table->string('username')->unique(); + }); }); } @@ -26,7 +28,7 @@ return new class extends Migration public function down() { Schema::table('users', function (Blueprint $table) { - // + $table->dropColumn('username'); }); } }; diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index c1c48a0..8a38994 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -14,11 +14,8 @@ class DatabaseSeeder extends Seeder */ public function run() { - // \App\Models\User::factory(10)->create(); - - // \App\Models\User::factory()->create([ - // 'name' => 'Test User', - // 'email' => 'test@example.com', - // ]); + $this->call([ + InitialSeeder::class, + ]); } } diff --git a/resources/js/Pages/Auth/Login.vue b/resources/js/Pages/Auth/Login.vue index 78ca693..844b468 100644 --- a/resources/js/Pages/Auth/Login.vue +++ b/resources/js/Pages/Auth/Login.vue @@ -14,7 +14,7 @@ defineProps({ }); const form = useForm({ - email: '', + username: '', password: '', remember: false, }); @@ -45,11 +45,11 @@ const submit = () => {
- + { />
+
+ + +
+