now login is using username not email

This commit is contained in:
Geriano
2022-07-16 01:13:45 +07:00
parent 12f7a74e10
commit 0a92d68068
9 changed files with 35 additions and 20 deletions

View File

@@ -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']),
]);
}

View File

@@ -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();
}
}