Comments:
on this page. Click to read or post your own.
Source for file PasswordValidator.php
Documentation is available at PasswordValidator.php
* This class represents a validator for member passwords.
* $pwdVal = new PasswordValidator();
* $pwdValidator->minLength(7);
* $pwdValidator->checkHistoricalPasswords(6);
* $pwdValidator->characterStrength('lowercase','uppercase','digits','punctuation');
* Member::set_password_validator($pwdValidator);
static $character_strength_tests =
array (
'lowercase' =>
'/[a-z]/' ,
'uppercase' =>
'/[A-Z]/' ,
'punctuation' =>
'/[^A-Za-z0-9]/' ,
* Minimum password length
* Check the character strength of the password.
* Eg: $this->characterStrength(3, array("lowercase", "uppercase", "digits", "punctuation"))
* @param $minScore The minimum number of character tests that must pass
* @param $testNames The names of the tests to perform
* Check a number of previous passwords that the user has used, and don't let them change to that.
if ( strlen ( $password ) <
$this -> minLength ) $valid -> error ( "Password is too short, it must be 7 or more characters long." , "TOO_SHORT" ) ;
if ( preg_match ( self :: $character_strength_tests [ $name ] , $password )) $score ++
;
else $missedTests [ ] =
$name ;
$valid -> error ( "You need to increase the strength of your passwords by adding some of the following characters: " .
implode ( ", " , $missedTests ) , "LOW_CHARACTER_STRENGTH" ) ;
if ( $previousPasswords ) foreach ( $previousPasswords as $previousPasswords ) {
if ( $previousPasswords -> checkPassword ( $password )) {
$valid -> error ( "You've already used that password in the past, please choose a new password" , "PREVIOUS_PASSWORD" ) ;
View the forum thread. blog comments powered by
Documentation generated on Mon, 12 May 2008 15:15:52 +1200 by phpDocumentor 1.3.2