Skip to content

make the dictionary words publishable #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions config/laravel-nist-password-rules.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

return [
'dictionary_words_file_path' => base_path("vendor/langleyfoxall/laravel-nist-password-rules/resources/words.txt"),
];
6 changes: 3 additions & 3 deletions src/Rules/DictionaryWords.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
*/
class DictionaryWords implements Rule
{
const DICTIONARY_FILE = __DIR__.'/../../resources/words.txt';

private $words = [];

/**
* DictionaryWords constructor.
*/
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));
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
]);
}

Expand Down