Skip to content

nickurt/laravel-pwned-passwords

Repository files navigation

Laravel Pwned Passwords

Build Status Total Downloads Latest Stable Version MIT Licensed

Installation

Install this package with composer:

composer require nickurt/laravel-pwned-passwords

Copy the config files for the PwnedPasswords-plugin

php artisan vendor:publish --provider="nickurt\PwnedPasswords\ServiceProvider" --tag="config"

Examples

Validation Rule - IsPwnedPassword

// FormRequest ...

public function rules()
{
    return [
        'password' => ['required', new \nickurt\PwnedPasswords\Rules\IsPwnedPassword(20)]
    ];
}

// Manually ...

$validator = validator()->make(request()->all(), ['password' => ['required', new \nickurt\PwnedPasswords\Rules\IsPwnedPassword(20)]]);

The IsPwnedPassword-rule has one optional paramter frequency (default 10) to validate the request.

Manually Usage - IsPwnedPassword

$isPwnedPassword = \PwnedPasswords::setFrequency(20)
    ->setPassword('laravel-pwned-passwords')
    ->isPwnedPassword();

Events

You can listen to the IsPwnedPassword event, e.g. if you want to log the IsPwnedPassword-requests in your application

IsPwnedPassword Event

This event will be fired when the password is above the frequency of pwned passwords nickurt\PwnedPasswords\Events\IsPwnedPassword

Tests

composer test

About

PwnedPasswords-plugin for Laravel 11.x/12.x

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 5

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy