luketowers/oc-pwnedpasswords-plugin

此软件包已被放弃,不再维护。作者建议使用 winter/wn-pwnedpasswords-plugin 软件包。

添加 notpwned 验证规则,以检查密码是否与 HIBP Pwned Passwords 服务冲突

资助软件包维护!
LukeTowers

安装: 586

依赖关系: 0

建议者: 0

安全: 0

星级: 2

关注者: 2

分支: 2

开放问题: 1

类型:winter-plugin

dev-main 2022-03-23 22:05 UTC

This package is auto-updated.

Last update: 2022-03-23 22:08:53 UTC


README

添加 notpwned:min 验证规则,使用范围搜索(k-anonymity)功能检查值是否与 HaveIBeenPwned Pwned Passwords 服务冲突,以保护隐私和安全。如果某个值被泄露超过 :min(默认为1)次,则提供的值将验证失败。

安装

要从 Marketplace 安装,点击“添加到项目”按钮,然后选择要将它添加到的项目,更新项目以拉入插件。

要从后端安装,转到 设置 -> 更新与插件 -> 安装插件,然后搜索 Winter.PwnedPasswords

要从 仓库 安装,将其克隆到 plugins/winter/pwnedpasswords,然后从您的项目根目录运行 composer update 以拉入依赖项。

要使用 Composer 安装,在项目根目录中运行 composer require winter/wn-pwnedpasswords-plugin

文档

通过密码被泄露的次数限制

您可以限制被拒绝的密码为那些至少被泄露一定次数的密码。例如,“password”已被泄露3,303,003次,然而“P@ssword!” 只被泄露118次。如果我们想阻止“password”但不是“P@ssword!”,我们可以指定最小次数为150,如下所示

'password' => 'required|string|min:6|notpwned:150|confirmed',

在后台认证中强制执行此规则

要强制在后台认证系统中执行此规则,在 config/winter/pwnedpasswords/config.php 中创建一个文件,并将以下内容放入其中

<?php return [

    /*
    |--------------------------------------------------------------------------
    | Enforce "notpwned" rule on backend users
    |--------------------------------------------------------------------------
    |
    | When this is enabled, the 'notpwned' validation rule is enforced on all
    | backend users by default. This means that they will not be able to update
    | their password to any password detected in a password breach, and if a
    | backend user tries to login with a "pwned" password, they will be rejected
    | and a password reset email will be sent to their email address for them to
    | change their password.
    */

    'enforceOnBackendUsers' => true,

];

覆盖验证消息

要覆盖验证消息,将插件中的 lang/en/lang.php 文件复制到 project/lang/$locale/winter/pwnedpasswords/lang.php