diff --git a/src/Rules/ReservedUsername.php b/src/Rules/ReservedUsername.php index 30451446..7b0a3607 100644 --- a/src/Rules/ReservedUsername.php +++ b/src/Rules/ReservedUsername.php @@ -4,11 +4,13 @@ namespace ARKEcosystem\Fortify\Rules; +use Illuminate\Support\Str; + class ReservedUsername { public function passes($attribute, $value): bool { - return ! in_array($value, trans('fortify::username_blacklist'), true); + return ! in_array(Str::lower($value), trans('fortify::username_blacklist'), true); } public function message(): string diff --git a/tests/Rules/ReservedUsernameTest.php b/tests/Rules/ReservedUsernameTest.php index ae18e9d6..52e68f98 100644 --- a/tests/Rules/ReservedUsernameTest.php +++ b/tests/Rules/ReservedUsernameTest.php @@ -19,6 +19,12 @@ 'president', 'server', 'staff', + 'Admin', + 'RoOt', + 'Www', + 'PresIDent', + 'ServEr', + 'StAfF', ]); it('allows adding username that isn\'t blacklisted', function ($username) {