🔒 Laravel validation rule that checks if a password has been exposed in a data breach.

Overview

🔒 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.')],
]);
Comments
  • Having issue on Windows.

    Having issue on Windows.

    Hi I am on windows and it's throwing an exception Your PHP installation does not supportsys_getloadavg(Windows?). Please setunixLoadUpperThresholdto-1in your DOFileCache config, but the unixLoadUpperThreshold is already set to -1 (default config) and I am still getting the above message. Any help would be great...

    Thanks

    opened by jason-guru 8
  • README: add more info how it works

    README: add more info how it works

    added a sentence and link that explains a bit more how it works, so future potential users don't have to go through composer.json and the library's README to find out.

    opened by janpio 2
  • Requires SSL?

    Requires SSL?

    Granted i'm in dev mode at the moment on a local homestead install, but I'm getting errors about not using SSL. Would the hookup with the underlying API require SSL perchance?

    Might be worth adding this to the readme too, in case. 👍

    opened by codepotato 1
  • Add PHP 8.0 support.

    Add PHP 8.0 support.

    • Allow PHP 8.0.
    • Update password_exposed to ensure PHP 8.0 is allowed there.
    • Remove a reference to a nonexistent directory in test config; blocked tests.
    • Update distro reference as Trusty doesn't support 8.0.
    opened by jameswilddev 0
  • Consider renaming rule to follow conventions

    Consider renaming rule to follow conventions

    First off, I think this is a great package!

    The only thing that stood out to me as a bit strange was the naming of the rule, PasswordExposed.

    We chatted about this briefly on Twitter, but I'll expand a little bit more here.

    If you look at Laravel's built-in validation rules, they are all named after the valid state of the field, rather than the invalid state. E.g. email, string, date. Additionally, the example custom Rule in the Laravel docs that validates that a field is all uppercase characters is called Uppercase.

    I think this package would have greater symmetry with Laravel's own rules if was named PasswordNotExposed (or NotPwned 😂)

    Obviously this is a pretty fundamental change, so you may like to consider keeping a PasswordExposed class that extends PasswordNotExposed to maintain backwards compatibility (I'm assuming that would work?)

    I'm happy to submit a PR if you like this idea, but given that it's renaming the main file of the package, I figured you might want your own name on that commit :)

    opened by jessarcher 0
  • Unable to Mock in Application Tests

    Unable to Mock in Application Tests

    I'm attempting to use this library in a project. I'd like to be able to mock it during unit tests, so my local tests don't try to reach out to external systems. However, the library exposes no hooks to slip in a mock during testing. I tried to skirt the issue by resolving an instance of the rule from the Laravel container, but that ended up bypassing the internal factory method.

    opened by mcordingley 2
Releases(v2.5.0)
Owner
Jordan Hall
Jordan Hall
A re-write of rakit/validation, a standalone validation library inspired by Laravel Validation

Somnambulist Validation This is a re-write of rakit/validation, a standalone validator like Laravel Validation. In keeping with rakit/validation, this

Somnambulist Tech 17 Nov 22, 2022
laminas-password-validator provides a validator for character-set based input validation.

laminas-password-validator laminas-password-validator provides a validator for character-set based input validation. Installation composer require pra

null 1 Mar 8, 2022
Abstracts HTTP request input handling, providing an easy interface for data hydration and validation

Linio Input Linio Input is yet another component of the Linio Framework. It aims to abstract HTTP request input handling, allowing a seamless integrat

Linio 41 Dec 12, 2021
An extensible validation library for your data with sane defaults.

Hird Hirds, also known as housecarls, was a gathering of hirdmen, who functioned as the king's personal guards during the viking age and the early mid

Asko Nõmm 13 Apr 23, 2022
高性能的验证器组件(Validation),适用于 Hyperf 或 Laravel 框架,可获得数百倍的性能提升

验证器 简介 兼容 Hyperf/Laravel Validation 规则 部分场景可获得约 500 倍性能提升 验证器可多次复用不同数据,无状态设计 规则可全局复用 智能合并验证规则 安装 环境要求 PHP >= 8.0 mbstring 扩展 ctype 扩展 安装命令 composer re

KK集团 78 Oct 17, 2022
Extension for the Laravel validation class

Intervention Validation Intervention Validation is an extension library for Laravel's own validation system. The package adds rules to validate data l

null 362 Nov 30, 2022
Extra validation rules for dealing with images in Laravel 5.

Image-Validator Extra validation rules for dealing with images in Laravel 5. NOTE: As of Laravel version 5.2, there are now built-in validation rules

Colin Viebrock 223 Jun 16, 2022
Laravel Validation Service

Laravel Validation Service Installation Add "prettus/laravel-repository": "1.1.*" to composer.json "prettus/laravel-validation": "1.1.*" Create a vali

Anderson Andrade 398 Nov 25, 2022
File uploads with validation and storage strategies

Upload This component simplifies file validation and uploading. Usage Assume a file is uploaded with this HTML form: <form method="POST" enctype="mult

Brandon Savage 1.7k Nov 13, 2022
Valitron is a simple, elegant, stand-alone validation library with NO dependencies

Valitron: Easy Validation That Doesn't Suck Valitron is a simple, minimal and elegant stand-alone validation library with NO dependencies. Valitron us

Vance Lucas 1.5k Nov 23, 2022
Lightweight and feature-rich PHP validation and filtering library. Support scene grouping, pre-filtering, array checking, custom validators, custom messages. 轻量且功能丰富的PHP验证、过滤库。支持场景分组,前置过滤,数组检查,自定义验证器,自定义消息。

PHP Validate 一个简洁小巧且功能完善的php验证、过滤库。 简单方便,支持添加自定义验证器 支持前置验证检查, 自定义如何判断非空 支持将规则按场景进行分组设置。或者部分验证 支持在进行验证前对值使用过滤器进行净化过滤内置过滤器 支持在进行验证前置处理和后置处理独立验证处理 支持自定义每

Inhere 244 Nov 5, 2022
[READ-ONLY] Validation library from CakePHP. This repo is a split of the main code that can be found in https://github.com/cakephp/cakephp

CakePHP Validation Library The validation library in CakePHP provides features to build validators that can validate arbitrary arrays of data with eas

CakePHP 39 Oct 11, 2022
Light and extendable schema validation library

Light PHP validation library For everyone who uses MongoDB or other NoSQL solution and cares about what client sends to his/her database and looking f

Alexander Serkin 43 Sep 28, 2022
One Line Validation, For CodeIgniter 4

One Line Validation (OLV) is a package made for CodeIgniter 4 to provide a fast and single line validation experience ideal for CDN and/or API services consuming the Validation System from CodeIgniter 4.

AJ Meireles 2 Sep 21, 2021
Validation rules for Money and Currency

money-validation-laravel Validation rules for Money and Currency Installation composer require brokeyourbike/money-validation-laravel Usage Package us

Ivan Stasiuk 1 Oct 25, 2021
FyreValidation is a free, open-source validation library for PHP.

FyreValidation FyreValidation is a free, validation library for PHP. Table Of Contents Installation Validators Rules Error Messages Installation Using

Elusive 0 Jan 15, 2022
This package contains validatiors of data used in Poland (PESEL, NIP, REGON etc.)

This package contains validatiors of data used in Poland (PESEL, NIP, REGON etc.)

Pawel Lukas 2 Mar 18, 2022
Laravel quickly creates a verification code tool similar to Google verification code

laravel-gridCaptcha Laravel quickly creates a verification code tool similar to Google verification code laravel 快速创建一个类似于 Google 点图验证码的本地验证码扩展 介绍 lar

delete DB Flee 14 Mar 1, 2022
Custom Laravel Validator for combined unique indexes

unique_with Validator Rule For Laravel This package contains a variant of the validateUnique rule for Laravel, that allows for validation of multi-col

Felix Kiss 383 Oct 18, 2022