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 842ff40..86b7552 100644 --- a/README.md +++ b/README.md @@ -28,10 +28,12 @@ To get the latest version of Laravel Password, simply add the following line to You'll then need to run `composer install` or `composer update` to download it and have the autoloader updated. -Once Laravel Password is installed, you need to register the service provider. Open up `config/app.php` and add the following to the `providers` key. - -* `Unicodeveloper\DumbPassword\DumbPasswordServiceProvider::class` +- If you're on Laravel 5.5 or above, that's all you need to do! Check out the usage examples below. +- If you're on Laravel < 5.5, you'll need to register the service provider. Open up `config/app.php` and add the following to the `providers` array: +```php +Unicodeveloper\DumbPassword\DumbPasswordServiceProvider::class +``` ## Usage @@ -56,8 +58,6 @@ protected function validator(array $data) Error shows on the page like so: -screen shot 2016-07-02 at 2 12 14 pm - screen shot 2016-07-02 at 1 22 45 pm By default, the error message returned is `This password is just too common. Please try another!`. @@ -68,9 +68,11 @@ You can customize the error message by opening `resources/lang/en/validation.php 'dumbpwd' => 'You are using a dumb password abeg', ``` +screen shot 2016-07-02 at 2 12 14 pm + ## Change log -Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently. +Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. ## Contributing diff --git a/composer.json b/composer.json index 7d53dc5..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": { @@ -42,6 +42,11 @@ "extra": { "branch-alias": { "dev-master": "1.0-dev" + }, + "laravel": { + "providers": [ + "Unicodeveloper\\DumbPassword\\DumbPasswordServiceProvider" + ] } } } 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 @@