now login is using username not email
This commit is contained in:
@@ -23,13 +23,15 @@ class CreateNewUser implements CreatesNewUsers
|
|||||||
Validator::make($input, [
|
Validator::make($input, [
|
||||||
'name' => ['required', 'string', 'max:255'],
|
'name' => ['required', 'string', 'max:255'],
|
||||||
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
||||||
|
'username' => ['required', 'string', 'max:255', 'unique:users'],
|
||||||
'password' => $this->passwordRules(),
|
'password' => $this->passwordRules(),
|
||||||
'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature() ? ['accepted', 'required'] : '',
|
'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature() ? ['accepted', 'required'] : '',
|
||||||
])->validate();
|
])->validate();
|
||||||
|
|
||||||
return User::create([
|
return User::create([
|
||||||
'name' => $input['name'],
|
'name' => mb_strtolower($input['name']),
|
||||||
'email' => $input['email'],
|
'email' => mb_strtolower($input['email']),
|
||||||
|
'username' => mb_strtolower($input['username']),
|
||||||
'password' => Hash::make($input['password']),
|
'password' => Hash::make($input['password']),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ class UpdateUserProfileInformation implements UpdatesUserProfileInformation
|
|||||||
Validator::make($input, [
|
Validator::make($input, [
|
||||||
'name' => ['required', 'string', 'max:255'],
|
'name' => ['required', 'string', 'max:255'],
|
||||||
'email' => ['required', 'email', 'max:255', Rule::unique('users')->ignore($user->id)],
|
'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'],
|
'photo' => ['nullable', 'mimes:jpg,jpeg,png', 'max:1024'],
|
||||||
])->validateWithBag('updateProfileInformation');
|
])->validateWithBag('updateProfileInformation');
|
||||||
|
|
||||||
@@ -33,8 +34,9 @@ class UpdateUserProfileInformation implements UpdatesUserProfileInformation
|
|||||||
$this->updateVerifiedUser($user, $input);
|
$this->updateVerifiedUser($user, $input);
|
||||||
} else {
|
} else {
|
||||||
$user->forceFill([
|
$user->forceFill([
|
||||||
'name' => $input['name'],
|
'name' => mb_strtolower($input['name']),
|
||||||
'email' => $input['email'],
|
'email' => mb_strtolower($input['email']),
|
||||||
|
'username' => mb_strtolower($input['username']),
|
||||||
])->save();
|
])->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class RouteServiceProvider extends ServiceProvider
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const HOME = '/dashboard';
|
public const HOME = '/';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define your route model bindings, pattern filters, and other route configuration.
|
* Define your route model bindings, pattern filters, and other route configuration.
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'username' => 'email',
|
'username' => 'username',
|
||||||
|
|
||||||
'email' => 'email',
|
'email' => 'email',
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ return [
|
|||||||
|
|
||||||
'features' => [
|
'features' => [
|
||||||
// Features::termsAndPrivacyPolicy(),
|
// Features::termsAndPrivacyPolicy(),
|
||||||
// Features::profilePhotos(),
|
Features::profilePhotos(),
|
||||||
// Features::api(),
|
// Features::api(),
|
||||||
// Features::teams(['invitations' => true]),
|
// Features::teams(['invitations' => true]),
|
||||||
Features::accountDeletion(),
|
Features::accountDeletion(),
|
||||||
|
|||||||
@@ -14,7 +14,9 @@ return new class extends Migration
|
|||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::table('users', function (Blueprint $table) {
|
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()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::table('users', function (Blueprint $table) {
|
Schema::table('users', function (Blueprint $table) {
|
||||||
//
|
$table->dropColumn('username');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,11 +14,8 @@ class DatabaseSeeder extends Seeder
|
|||||||
*/
|
*/
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
// \App\Models\User::factory(10)->create();
|
$this->call([
|
||||||
|
InitialSeeder::class,
|
||||||
// \App\Models\User::factory()->create([
|
]);
|
||||||
// 'name' => 'Test User',
|
|
||||||
// 'email' => 'test@example.com',
|
|
||||||
// ]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ defineProps({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const form = useForm({
|
const form = useForm({
|
||||||
email: '',
|
username: '',
|
||||||
password: '',
|
password: '',
|
||||||
remember: false,
|
remember: false,
|
||||||
});
|
});
|
||||||
@@ -45,11 +45,11 @@ const submit = () => {
|
|||||||
|
|
||||||
<form @submit.prevent="submit">
|
<form @submit.prevent="submit">
|
||||||
<div>
|
<div>
|
||||||
<JetLabel for="email" value="Email" />
|
<JetLabel for="username" value="Username" />
|
||||||
<JetInput
|
<JetInput
|
||||||
id="email"
|
id="username"
|
||||||
v-model="form.email"
|
v-model="form.username"
|
||||||
type="email"
|
type="text"
|
||||||
class="mt-1 block w-full"
|
class="mt-1 block w-full"
|
||||||
required
|
required
|
||||||
autofocus
|
autofocus
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import JetValidationErrors from '@/Jetstream/ValidationErrors.vue';
|
|||||||
const form = useForm({
|
const form = useForm({
|
||||||
name: '',
|
name: '',
|
||||||
email: '',
|
email: '',
|
||||||
|
username: '',
|
||||||
password: '',
|
password: '',
|
||||||
password_confirmation: '',
|
password_confirmation: '',
|
||||||
terms: false,
|
terms: false,
|
||||||
@@ -58,6 +59,17 @@ const submit = () => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</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">
|
<div class="mt-4">
|
||||||
<JetLabel for="password" value="Password" />
|
<JetLabel for="password" value="Password" />
|
||||||
<JetInput
|
<JetInput
|
||||||
|
|||||||
Reference in New Issue
Block a user