Skip to content

rovico/YiiPasswordValidator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SPasswordValidator 1.2

SPasswordValidator is a password validator for the Yii framework. Tested with yii 1.1.12.

It's to use for a form/model validation rule.

Features

  • Ready to use out of the box (see example basic below)

  • Presets to choose required strength (relax, normal, strong)

  • Customize parameters

    • minimum number of characters
    • minimum number of upper case characters
    • minimum number of lower case characters
    • minimum number of digits characters
    • minimum number of special characters
  • Max parameter to avoid using another validator (in case you store value not encoded)

  • Documentation included

  • Coded using unit tests

Examples

Basic (default params)

    public function rules()
    {
        return array(
            array('password','ext.SPasswordValidator.SPasswordValidator');
        );
    }

With preset

    public function rules()
    {
        return array(
            array('password','ext.SPasswordValidator.SPasswordValidator', 'preset' => 'relax');
        );
    }

With custom parameters

Number of upper case chars set to 1, minimum number of characters set to 10.

    public function rules()
    {
        return array(
            array('password','ext.SPasswordValidator.SPasswordValidator', 'up' => 1, 'min' => 10);
        );
    }

Preset strong plus a max length (in case you store something else that a password, not encrypted)

    public function rules()
    {
        return array(
            array('password','ext.SPasswordValidator.SPasswordValidator', 'preset' => 'strong', 'max' => 41);
        );
    }

Parameter other than max will be overriden by the preset parameters value.

Installation

Uncompress the archive in protected/extensions/. So path to php file will be protected/extensions/SPasswordValidator/SPasswordValidator.php.

Problem ?

Open an issue.

Contribute

Use to the fullapp branch to fork (include phpunit's unit tests)

Licences

This code is published under the Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) licence.

Included

The fullapp branch includes YiiDocumentor published under the GNU LESSER GENERAL PUBLIC LICENSE 3

About

A yii model/form validator for passwords

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 75.6%
  • CSS 24.4%