divineomega / laravel-password-exposed-validation-rule
Laravel validation rule that checks if a password has been exposed in a data breach
Fund package maintenance!
DivineOmega
Installs: 644 082
Dependents: 2
Suggesters: 0
Security: 0
Stars: 89
Watchers: 8
Forks: 29
Open Issues: 3
Requires
- php: ^7.1||^8.0||8.1
- divineomega/password_exposed: ^3.2.0
- illuminate/contracts: ^5.1||^6.0||^7.0||^8.0||^9.0
Requires (Dev)
- php-coveralls/php-coveralls: ^2.0
- phpunit/phpunit: ^7.0||^8.0||^9.0
README
This package provides a Laravel validation rule that checks if a password has been exposed in a data breach. It uses the haveibeenpwned.com passwords API via the divineomega/password_exposed
library.
Installation
To install, just run the following Composer command.
composer require divineomega/laravel-password-exposed-validation-rule
Please note that this package requires Laravel 5.1 or above.
Usage
The following code snippet shows an example of how to use the password exposed validation rule.
use DivineOmega\LaravelPasswordExposedValidationRule\PasswordExposed; $request->validate([ 'password' => ['required', new PasswordExposed()], ]);
If you wish, you can also set a custom validation message, as shown below.
use DivineOmega\LaravelPasswordExposedValidationRule\PasswordExposed; $request->validate([ 'password' => ['required', (new PasswordExposed())->setMessage('This password is not secure.')], ]);