added password policy settings

This commit is contained in:
Roland Gruber 2008-02-10 13:19:05 +00:00
parent bb0ecf864f
commit b5ee91b50e
3 changed files with 77 additions and 1 deletions

View File

@ -134,6 +134,8 @@ $helpArray = array (
"Text" => _("Here you can select where LAM should save its log messages. System logging will go to Syslog on Unix systems and event log on Windows. You can also select an extra file.")),
"241" => array ("Headline" => _("Allowed hosts"),
"Text" => _("This is a list of IP addresses from hosts who may access LAM. You can use \"*\" as wildcard (e.g. 192.168.0.*).")),
"242" => array ("Headline" => _("Password policy"),
"Text" => _("Here you can specify minimum requirements for passwords. The character classes are: lowercase, uppercase, numeric and symbols.")),
"250" => array ("Headline" => _("Account lists - Filters"),
"Text" => _("Here you can input small filter expressions (e.g. 'value' or 'v*'). LAM will filter case-insensitive.")),
// 300 - 399

View File

@ -899,9 +899,29 @@ class LAMCfgMain {
/** list of hosts which may access LAM */
public $allowedHosts;
/** minimum length for passwords */
public $passwordMinLength = 0;
/** minimum uppercase characters */
public $passwordMinUpper = 0;
/** minimum lowercase characters */
public $passwordMinLower = 0;
/** minimum numeric characters */
public $passwordMinNumeric = 0;
/** minimum symbol characters */
public $passwordMinSymbol = 0;
/** minimum character classes (upper, lower, numeric, symbols) */
public $passwordMinClasses = 0;
/** list of data fields to save in config file */
private $settings = array("password", "default", "sessionTimeout",
"logLevel", "logDestination", "allowedHosts");
"logLevel", "logDestination", "allowedHosts", "passwordMinLength",
"passwordMinUpper", "passwordMinLower", "passwordMinNumeric",
"passwordMinClasses", "passwordMinSymbol");
/**
* Loads preferences from config file
@ -981,6 +1001,12 @@ class LAMCfgMain {
if (!in_array("logLevel", $saved)) array_push($file_array, "\n\n# log level\n" . "logLevel: " . $this->logLevel);
if (!in_array("logDestination", $saved)) array_push($file_array, "\n\n# log destination\n" . "logDestination: " . $this->logDestination);
if (!in_array("allowedHosts", $saved)) array_push($file_array, "\n\n# list of hosts which may access LAM\n" . "allowedHosts: " . $this->allowedHosts);
if (!in_array("passwordMinLength", $saved)) array_push($file_array, "\n\n# Password: minimum password length\n" . "passwordMinLength: " . $this->passwordMinLength);
if (!in_array("passwordMinUpper", $saved)) array_push($file_array, "\n\n# Password: minimum uppercase characters\n" . "passwordMinUpper: " . $this->passwordMinUpper);
if (!in_array("passwordMinLower", $saved)) array_push($file_array, "\n\n# Password: minimum lowercase characters\n" . "passwordMinLower: " . $this->passwordMinLower);
if (!in_array("passwordMinNumeric", $saved)) array_push($file_array, "\n\n# Password: minimum numeric characters\n" . "passwordMinNumeric: " . $this->passwordMinNumeric);
if (!in_array("passwordMinSymbol", $saved)) array_push($file_array, "\n\n# Password: minimum symbolic characters\n" . "passwordMinSymbol: " . $this->passwordMinSymbol);
if (!in_array("passwordMinClasses", $saved)) array_push($file_array, "\n\n# Password: minimum character classes (0-4)\n" . "passwordMinClasses: " . $this->passwordMinClasses);
$file = @fopen($conffile, "w");
if ($file) {
for ($i = 0; $i < sizeof($file_array); $i++) fputs($file, $file_array[$i]);

View File

@ -122,6 +122,13 @@ if ($_POST['submit']) {
}
else $errors[] = _("The log file is empty or contains invalid characters! Valid characters are: a-z, A-Z, 0-9, /, \\, ., :, _ and -.");
}
// password policies
$cfg->passwordMinLength = $_POST['passwordMinLength'];
$cfg->passwordMinLower = $_POST['passwordMinLower'];
$cfg->passwordMinUpper = $_POST['passwordMinUpper'];
$cfg->passwordMinNumeric = $_POST['passwordMinNumeric'];
$cfg->passwordMinSymbol = $_POST['passwordMinSymbol'];
$cfg->passwordMinClasses = $_POST['passwordMinClasses'];
// save settings
$cfg->save();
// print messages
@ -195,6 +202,47 @@ if ($_POST['submit']) {
</table>
</fieldset>
<BR>
<fieldset>
<legend><b> <?php echo _("Password policy"); ?> </b></legend>
<br>
<table cellspacing="0" border="0">
<?php
$options = array(
array('passwordMinLength', _('Minimum password length'), 20),
array('passwordMinLower', _('Minimum lowercase characters'), 20),
array('passwordMinUpper', _('Minimum uppercase characters'), 20),
array('passwordMinNumeric', _('Minimum numeric characters'), 20),
array('passwordMinSymbol', _('Minimum symbolic characters'), 20),
array('passwordMinClasses', _('Minimum character classes'), 4)
);
for ($i = 0; $i < sizeof($options); $i++) {
echo "<tr>\n";
echo "<td>\n";
echo $options[$i][1] . "&nbsp;&nbsp;";
echo "</td>\n";
echo "<td>\n";
echo "<select name=\"" . $options[$i][0] . "\">\n";
for ($o = 0; $o <= $options[$i][2]; $o++) {
$selected = '';
if ($cfg->$options[$i][0] == $o) {
$selected = ' selected';
}
echo "<option" . $selected . ">" . $o . "</option>\n";
}
echo "</select>\n";
echo "</td>\n";
echo "<td>\n";
echo "<a href=\"../help.php?HelpNumber=242\" target=\"lamhelp\">";
echo "<img src=\"../../graphics/help.png\" alt=\"" . _('Help') . "\" title=\"" . _('Help') . "\">";
echo "</a>\n";
echo "</td>\n";
echo "</tr>\n";
}
?>
</table>
<br>
</fieldset>
<BR>
<fieldset>
<legend><b> <?php echo _("Logging"); ?> </b></legend>
<br>