Skip to content

πŸ”’ Laravel validation rule that checks if a password has been exposed in a data breach.

License

Notifications You must be signed in to change notification settings

DivineOmega/laravel-password-exposed-validation-rule

Folders and files

NameName
Last commit message
Last commit date
Apr 26, 2018
Feb 4, 2019
Mar 4, 2020
Sep 6, 2019
Feb 15, 2019
Apr 5, 2022
Apr 26, 2018
Sep 6, 2019
Apr 5, 2022
Apr 20, 2021

Repository files navigation

πŸ”’ Laravel Password Exposed Validation Rule

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.

Travis CI Coverage Status StyleCI

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.')],
]);