Skip to content
This repository has been archived by the owner on Oct 1, 2021. It is now read-only.

Commit

Permalink
fix: make ReservedUserName rule working with case insensitive values (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
leMaur authored Apr 20, 2021
1 parent 7341541 commit 6ca2719
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Rules/ReservedUsername.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions tests/Rules/ReservedUsernameTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
'president',
'server',
'staff',
'Admin',
'RoOt',
'Www',
'PresIDent',
'ServEr',
'StAfF',
]);

it('allows adding username that isn\'t blacklisted', function ($username) {
Expand Down

0 comments on commit 6ca2719

Please sign in to comment.