Skip to content

Commit 54f415a

Browse files
committed
♿ correction de l'enregistrement des username dans le bon format
1 parent 269b8d6 commit 54f415a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

app/Actions/Fortify/CreateNewUser.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use App\Models\User;
66
use Illuminate\Support\Facades\Hash;
77
use Illuminate\Support\Facades\Validator;
8+
use Illuminate\Support\Str;
89
use Illuminate\Validation\Rule;
910
use Laravel\Fortify\Contracts\CreatesNewUsers;
1011

@@ -35,6 +36,7 @@ public function create(array $input): User
3536
'string',
3637
'min:6',
3738
'max:20',
39+
'alpha_dash',
3840
Rule::unique(User::class, 'username'),
3941
],
4042
'password' => $this->passwordRules(),
@@ -43,9 +45,9 @@ public function create(array $input): User
4345
return User::create([
4446
'name' => $input['name'],
4547
'email' => $input['email'],
46-
'username' => $input['username'],
47-
'opt_in' => isset($input['opt_in']),
48+
'username' => Str::lower($input['username']),
4849
'password' => Hash::make($input['password']),
50+
'opt_in' => isset($input['opt_in']),
4951
]);
5052
}
5153
}

0 commit comments

Comments
 (0)