langleyfoxall / laravel-nist-password-rules

🔒 Laravel validation rules that follow the password related recommendations found in NIST Special Publication 800-63B section 5.
GNU Lesser General Public License v3.0
208 stars 49 forks source link

PHP_EOL Windows #41

Closed GaraiViktor closed 3 years ago

GaraiViktor commented 3 years ago

rules are won't work on windows, PHP_EOL on Windows is not "\n" but "\r\n".

The passwords property has incorrect value, only has one item with the full content of txt, instead of one item per row.

I have 2 suggestion:

  1. change explode to preg_split. preg_split('/\n|\r\n?/', file_get_contents(self::PASSWORDS_FILE))
  2. or just hardcode the \n line end character. explode('\n', file_get_contents(self::PASSWORDS_FILE))
DivineOmega commented 3 years ago

This should now be fixed: https://github.com/langleyfoxall/laravel-nist-password-rules/releases/tag/v5.0.1