diff --git a/README.md b/README.md index 7736133..e1bbd24 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ composer require langleyfoxall/laravel-nist-password-rules If you have never used the Composer dependency manager before, head to the Composer website for more information on how to get started. -Optionally, you may publish the package's translation files with +Optionally, you may publish the package's translation and config files with the following Artisan command. ```bash diff --git a/config/laravel-nist-password-rules.php b/config/laravel-nist-password-rules.php new file mode 100644 index 0000000..85ee9e6 --- /dev/null +++ b/config/laravel-nist-password-rules.php @@ -0,0 +1,5 @@ + base_path("vendor/langleyfoxall/laravel-nist-password-rules/resources/words.txt"), +]; \ No newline at end of file diff --git a/src/Rules/DictionaryWords.php b/src/Rules/DictionaryWords.php index 52b459f..5bf6488 100644 --- a/src/Rules/DictionaryWords.php +++ b/src/Rules/DictionaryWords.php @@ -12,8 +12,6 @@ */ class DictionaryWords implements Rule { - const DICTIONARY_FILE = __DIR__.'/../../resources/words.txt'; - private $words = []; /** @@ -21,7 +19,9 @@ class DictionaryWords implements Rule */ public function __construct() { - $this->words = explode("\n", file_get_contents(self::DICTIONARY_FILE)); + $dictionaryFile = config('laravel-nist-password-rules.dictionary_words_file_path'); + + $this->words = explode("\n", file_get_contents($dictionaryFile)); } /** diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index 343f8ca..1e8ef78 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -15,6 +15,7 @@ public function boot() $this->publishes([ __DIR__.'/../resources/lang' => resource_path('lang/vendor/laravel-nist-password-rules'), + __DIR__.'/../config/laravel-nist-password-rules.php' => config_path('laravel-nist-password-rules.php'), ]); }