This validator checks if password is strong enough. Password is strong enough, if it have defined minimum number of characters(which can be changed), and if it contain at least one upper case letter, at least one lower case letter, and at least one number.
Requirements ¶
Class is developed and tested using Yii version 1.1.7
Usage ¶
Unzip the contents of the zip file onto your protected/extensions/validators folder, then edit rules method of the model class as following:
public function rules()
{
return array(
array(array('password','ext.validators.EPasswordStrength', 'min'=>7),
);
}
Resources ¶
Change Log ¶
0.1 ¶
- Initial release
Update Sample
public function rules() { return array( array('password', 'ext.validators.EPasswordStrength', 'min' => 7, 'message' => Yii::t('category', 'Error Message')), ); }
Bug with Internationalization
I found a bug in the line 31, because when I run the yiic message messagePath shows me an error...
the wrong line is:
$message=$this->message!==null?$this->message:Yii::t("EPasswordStrength","{attribute} is weak. {attribute} must contain at least {$this->min} characters, at least one lower case letter, at least one upper case letter, and at least one number.");
and the fixed one:
$message=$this->message!==null?$this->message:Yii::t("EPasswordStrength","{attribute} is weak. {attribute} must contain at least {min} characters, at least one lower case letter, at least one upper case letter, and at least one number.", array("{min}"=>$this->min));
this is the way you should pass the params..
Yii::t('app', 'Path alias "{alias}" is redefined.',
array('{alias}'=>$alias))
according to:
http://www.yiiframework.com/doc/guide/1.1/en/topics.i18n#internationalization
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.