[sork] passwd policy patch
John Dalbec
jpdalbec at ysu.edu
Fri Apr 4 10:00:31 PST 2003
This change adds a "minNonAlpha" password policy item. Our password
rules require at least one non-alphabetic character, but it can be a
digit or punctuation mark. (We don't allow spaces.)
Hm. Would it make sense to change
} elseif ($char === ' ') {
to
} elseif (preg_match('/[[:space:]]/', $char)) {
?
-------------- next part --------------
--- /var/www/html/horde-RELENG/passwd/main.php Fri Feb 14 10:41:31 2003
+++ ./main.php Fri Apr 4 09:44:51 2003
@@ -95,9 +95,11 @@
} elseif (ctype_upper($char)) {
$upper++; $alpha++; $alnum++;
} elseif (ctype_digit($char)) {
- $num++; $alnum++;
+ $num++; $alnum++; $nonalpha++;
} elseif (ctype_space($char)) {
- $space++;
+ $space++; $nonalpha++;
+ } else {
+ $nonalpha++;
}
} else {
if (preg_match('/[[:lower:]]/', $char)) {
@@ -105,9 +107,11 @@
} elseif (preg_match('/[[:upper:]]/', $char)) {
$upper++; $alpha++; $alnum++;
} elseif (preg_match('/[[:digit:]]/', $char)) {
- $num++; $alnum++;
+ $num++; $alnum++; $nonalpha++;
} elseif ($char === ' ') {
- $space++;
+ $space++; $nonalpha++;
+ } else {
+ $nonalpha++;
}
}
}
@@ -126,6 +130,11 @@
if (array_key_exists('minNumeric', $passwordPolicy) &&
$passwordPolicy['minNumeric'] > $num) {
Horde::raiseMessage(sprintf(_("Your new password must contain at least %d numeric characters."), $passwordPolicy['minNumeric']), HORDE_WARNING);
+ break;
+ }
+ if (array_key_exists('minNonAlpha', $passwordPolicy) &&
+ $passwordPolicy['minNonAlpha'] > $nonalpha) {
+ Horde::raiseMessage(sprintf(_("Your new password must contain at least %d non-alphabetic characters."), $passwordPolicy['minNonAlpha']), HORDE_WARNING);
break;
}
if (array_key_exists('minAlpha', $passwordPolicy) &&
More information about the sork
mailing list