class And_Constraint in Password Policy 5
Hierarchy
- class \Constraint
- class \And_Constraint
Expanded class hierarchy of And_Constraint
1 string reference to 'And_Constraint'
File
- constraints/
constraint_and.php, line 5
View source
class And_Constraint extends Constraint {
var $constraints;
var $expiration;
var $warning;
function And_Constraint() {
$this->constraints = array();
}
function validate($plaintext_password, $user = NULL) {
foreach ($this->constraints as $constraint) {
if (!$constraint
->validate($plaintext_password, $user)) {
return 0;
}
}
return 1;
}
function getDescription() {
return $this
->getValidationErrorMessage();
}
function getValidationErrorMessage($plaintext_password = NULL, $user = NULL) {
$reason = '<ul>';
foreach ($this->constraints as $constraint) {
$msg = NULL;
// if we have a password to test, then indicate in the validation error
// message, which constraints passed and which failed.
if (isset($plaintext_password)) {
if ($constraint
->validate($plaintext_password, $user)) {
$msg = t('(PASS)') . ' ' . $constraint
->getValidationErrorMessage();
}
else {
$msg = t('(FAIL)') . ' ' . $constraint
->getValidationErrorMessage();
}
}
else {
$msg = $constraint
->getValidationErrorMessage();
}
$reason .= "<li>{$msg}</li>";
}
return $reason . '</ul>';
}
function addConstraint($constraint) {
array_push($this->constraints, $constraint);
}
function getConstraints() {
return $this->constraints;
}
function getExpiration() {
return $this->expiration;
}
function setExpiration($expiration) {
$this->expiration = $expiration;
}
function getWarning() {
return $this->warning;
}
function setWarning($warning) {
$this->warning = $warning;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
And_Constraint:: |
property | |||
And_Constraint:: |
property | |||
And_Constraint:: |
property | |||
And_Constraint:: |
function | |||
And_Constraint:: |
function | |||
And_Constraint:: |
function | |||
And_Constraint:: |
function |
Overrides Constraint:: |
||
And_Constraint:: |
function | |||
And_Constraint:: |
function |
Overrides Constraint:: |
||
And_Constraint:: |
function | |||
And_Constraint:: |
function | |||
And_Constraint:: |
function | |||
And_Constraint:: |
function |
Overrides Constraint:: |
||
Constraint:: |
property | |||
Constraint:: |
property | |||
Constraint:: |
property | |||
Constraint:: |
function | |||
Constraint:: |
function | |||
Constraint:: |
function | |||
Constraint:: |
function | |||
Constraint:: |
function |