This extension provides a couple of great password management utilities for Yii Framework 2.0. The extension allows password strength validation through your model. In addition, it provides an advanced password input widget, that allows you to display/hide text and show the password strength.
Refer the CHANGE LOG for details of various releases.
VIEW DEMO
This is a password strength validator for your model attributes. The strength validator allows you to configure the following parameters for validating passwords or strings.
Other features:
NOTE: The StrengthValidator does not validate if the password field is required. You need to use Yii's
required
rule for this.
VIEW DEMO
This is an advanced password input widget with configurable options and a dynamic strength meter based on the Strength Meter JQuery Plugin by Krajee. The widget provides various features as mentioned below:
You can see a demonstration here on usage of these functions with documentation and examples.
The preferred way to install this extension is through composer.
Note: Check the composer.json for this extension's requirements and dependencies. Read this web tip /wiki on setting the
minimum-stability
settings for your application's composer.json.
Either run
$ php composer.phar require kartik-v/yii2-password "@dev"
or add
"kartik-v/yii2-password": "@dev"
to the require
section of your composer.json
file.
// add this in your model
use kartik\password\StrengthValidator;
// use the validator in your model rules
public function rules() {
return [
[['username', 'password'], 'required'],
[['password'], StrengthValidator::className(), 'preset'=>'normal', 'userAttribute'=>'username']
];
}
// add this in your view
use kartik\password\PasswordInput;
use kartik\widgets\ActiveForm; // optional
$form = ActiveForm::begin(['id' => 'login-form']);
echo $form->field($model,'username');
echo $form->field($model, 'password')->widget(PasswordInput::classname(), [
'pluginOptions' => [
'showMeter' => true,
'toggleMask' => false
]
]);
yii2-password is released under the BSD-3-Clause License. See the bundled LICENSE.md
for details.
yii2-password
Date: under development
Date: 16-May-2022
Date: 15-Jun-2020
haveIBeenPwned
correctly and default to false
for BC.Date: 08-Jun-2020
allowSpaces
.allowSpaces
. Date: 07-Sep-2018
src
directory.Date: 10-Jan-2016
usernameValue
property that will be used without model or usernameAttribute
. If this is provided the usernameAttribute
will be skipped.StrengthValidator::strError
property (BC Breaking). Use the StrengthValidator::message
property instead.validateValue
allowSpaces
and allowSpacesError
. Date: 14-Jul-2015
Date: 17-Jun-2015
Date: 12-Jan-2015
hasUser
is true.kv
prefix.Date: 20-Nov-2014
Date: 10-Nov-2014
Date: 31-Oct-2014
Date: 28-Feb-2014
Initial release
Comments