now login is using username not email
This commit is contained in:
@@ -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']),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -46,7 +46,7 @@ return [
|
||||
|
|
||||
*/
|
||||
|
||||
'username' => 'email',
|
||||
'username' => 'username',
|
||||
|
||||
'email' => 'email',
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ return [
|
||||
|
||||
'features' => [
|
||||
// Features::termsAndPrivacyPolicy(),
|
||||
// Features::profilePhotos(),
|
||||
Features::profilePhotos(),
|
||||
// Features::api(),
|
||||
// Features::teams(['invitations' => true]),
|
||||
Features::accountDeletion(),
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ defineProps({
|
||||
});
|
||||
|
||||
const form = useForm({
|
||||
email: '',
|
||||
username: '',
|
||||
password: '',
|
||||
remember: false,
|
||||
});
|
||||
@@ -45,11 +45,11 @@ const submit = () => {
|
||||
|
||||
<form @submit.prevent="submit">
|
||||
<div>
|
||||
<JetLabel for="email" value="Email" />
|
||||
<JetLabel for="username" value="Username" />
|
||||
<JetInput
|
||||
id="email"
|
||||
v-model="form.email"
|
||||
type="email"
|
||||
id="username"
|
||||
v-model="form.username"
|
||||
type="text"
|
||||
class="mt-1 block w-full"
|
||||
required
|
||||
autofocus
|
||||
|
||||
@@ -11,6 +11,7 @@ import JetValidationErrors from '@/Jetstream/ValidationErrors.vue';
|
||||
const form = useForm({
|
||||
name: '',
|
||||
email: '',
|
||||
username: '',
|
||||
password: '',
|
||||
password_confirmation: '',
|
||||
terms: false,
|
||||
@@ -58,6 +59,17 @@ const submit = () => {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="mt-4">
|
||||
<JetLabel for="username" value="Username" />
|
||||
<JetInput
|
||||
id="username"
|
||||
v-model="form.username"
|
||||
type="text"
|
||||
class="mt-1 block w-full"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="mt-4">
|
||||
<JetLabel for="password" value="Password" />
|
||||
<JetInput
|
||||
|
||||
Reference in New Issue
Block a user