Skip to content

Commit bc9efa7

Browse files
Perform case insensitive comparison against the password list
Make the password list and user provided password both lowercase, so bad passwords are always identified regardless of how many characters are capitalised
1 parent 39d0e7b commit bc9efa7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/DumbPasswordServiceProvider.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,12 @@ public function boot()
4040
$path = realpath(__DIR__ . '/../resources/config/passwordlist.txt');
4141
$cache_key = md5_file($path);
4242
$data = Cache::rememberForever('dumbpwd_list_' . $cache_key, function () use ($path) {
43-
return collect(explode("\n", file_get_contents($path)));
43+
return collect(explode("\n", file_get_contents($path)))
44+
->map(function ($password) {
45+
return strtolower($password);
46+
});
4447
});
45-
return !$data->contains($value);
48+
return !$data->contains(strtolower($value));
4649
}, $this->message);
4750
}
4851

@@ -56,7 +59,7 @@ public function register()
5659

5760
/**
5861
* Get the services provided by the provider.
59-
*
62+
*
6063
* @return array
6164
*/
6265
public function provides()

0 commit comments

Comments
 (0)