nstcactus / yii2-pwned-validator
一个针对 HIBP pwned passwords API 的 Yii2 密码验证器
1.0.0
2019-06-23 22:21 UTC
Requires
- ext-mbstring: *
- yiisoft/yii2: ^2.0.0
This package is auto-updated.
Last update: 2024-08-24 17:36:51 UTC
README
这是一个针对 Pwned passwords 数据库 的 Yii2 密码验证器。
Pwned Passwords 指的是超过五亿的密码,这些密码在数据泄露中已经暴露。由于这些密码存在被用于接管其他账户的更大风险,因此它们不适宜继续使用。
要求
- Yii 框架 2
- PHP
mbstring
(多字节字符串) 扩展(必需)
安装
安装此扩展的最佳方式是通过 Composer。
安装,可以运行
$ composer require nstcactus/yii2-pwned-validator
或者将以下内容添加到您的 composer.json
文件的 require
部分。
"nstcactus/yii2-pwned-validator": "*"
使用
模型类示例
<?php namespace app\models; use nstCactus\yii2\validators\PwnedValidator; use Yii; use yii\base\Model; class YourCustomModel extends Model { public function rules() { return [ ['newPassword', PwnedValidator::class], ]; } public function attributeLabels() { return [ 'newPassword' => Yii::t('app', 'New password'), ]; } }
此验证器将无法验证在已知安全漏洞中泄露的密码。
喜欢吗?
向 Troy Hunt(Have I been pwned? 的作者)表达您的支持。