diff --git a/.travis.yml b/.travis.yml
index af76124..ad6b5f6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,10 +1,8 @@
language: php
php:
- - 5.5
- - 5.6
- 7.0
- - hhvm
+ - 8.0
# This triggers builds to run on the new TravisCI infrastructure.
# See: http://docs.travis-ci.com/user/workers/container-based-infrastructure/
@@ -17,7 +15,7 @@ cache:
matrix:
include:
- - php: 5.5
+ - php: 7.0
env: 'COMPOSER_FLAGS="--prefer-stable --prefer-lowest"'
before_script:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 89585cb..53acea4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,11 @@ All Notable changes to `laravel-password` will be documented in this file.
Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
+## 2020-12-30
+
+- Make passwords case insensitive.
+- Support PHP 8
+
## 2017-04-26
- Removed the flip method
diff --git a/README.md b/README.md
index 44d836d..86b7552 100644
--- a/README.md
+++ b/README.md
@@ -58,8 +58,6 @@ protected function validator(array $data)
Error shows on the page like so:
-
-
By default, the error message returned is `This password is just too common. Please try another!`.
@@ -70,6 +68,8 @@ You can customize the error message by opening `resources/lang/en/validation.php
'dumbpwd' => 'You are using a dumb password abeg',
```
+
+
## Change log
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
diff --git a/composer.json b/composer.json
index 001c101..971ce2a 100644
--- a/composer.json
+++ b/composer.json
@@ -19,10 +19,10 @@
}
],
"require": {
- "php" : "~5.6|~7.0"
+ "php" : "~7.0 || ~8.0"
},
"require-dev": {
- "phpunit/phpunit" : "~4.0||~5.0",
+ "phpunit/phpunit" : "~8.0 || ~9.0",
"scrutinizer/ocular": "~1.1",
"squizlabs/php_codesniffer": "~2.3"
},
@@ -33,7 +33,7 @@
},
"autoload-dev": {
"psr-4": {
- "Unicodeveloper\\DumbPassword\\Test": "tests"
+ "Unicodeveloper\\DumbPassword\\Test\\": "tests"
}
},
"scripts": {
diff --git a/src/DumbPasswordServiceProvider.php b/src/DumbPasswordServiceProvider.php
index b5cb6da..719e926 100644
--- a/src/DumbPasswordServiceProvider.php
+++ b/src/DumbPasswordServiceProvider.php
@@ -40,9 +40,12 @@ public function boot()
$path = realpath(__DIR__ . '/../resources/config/passwordlist.txt');
$cache_key = md5_file($path);
$data = Cache::rememberForever('dumbpwd_list_' . $cache_key, function () use ($path) {
- return collect(explode("\n", file_get_contents($path)));
+ return collect(explode("\n", file_get_contents($path)))
+ ->map(function ($password) {
+ return strtolower($password);
+ });
});
- return !$data->contains($value);
+ return !$data->contains(strtolower($value));
}, $this->message);
}
diff --git a/tests/ExampleTest.php b/tests/ExampleTest.php
index a3b4876..974c886 100644
--- a/tests/ExampleTest.php
+++ b/tests/ExampleTest.php
@@ -1,8 +1,9 @@