mirror of
https://github.com/LDAPAccountManager/lam.git
synced 2025-10-03 09:49:16 +02:00
#390 password policy for configuration
This commit is contained in:
parent
c0d027e7ad
commit
49e4d19ffb
1 changed files with 16 additions and 10 deletions
|
@ -79,7 +79,13 @@ if (isset($_POST['action'])) {
|
||||||
// add new profile
|
// add new profile
|
||||||
elseif ($_POST['action'] == "add") {
|
elseif ($_POST['action'] == "add") {
|
||||||
// check profile password
|
// check profile password
|
||||||
if ($_POST['addpassword'] && $_POST['addpassword2'] && ($_POST['addpassword'] == $_POST['addpassword2'])) {
|
if (empty($_POST['addpassword']) || ($_POST['addpassword'] !== $_POST['addpassword2'])) {
|
||||||
|
$error = _("Profile passwords are different or empty!");
|
||||||
|
}
|
||||||
|
elseif (!isValidConfigurationPassword($_POST['addpassword'])) {
|
||||||
|
$error = _('Please enter at least 8 characters including letters, a number and a symbol.');
|
||||||
|
}
|
||||||
|
else {
|
||||||
try {
|
try {
|
||||||
$serverProfilePersistenceManager->createProfileFromTemplate($_POST['addprofile'], $_POST['addTemplate'], $_POST['addpassword']);
|
$serverProfilePersistenceManager->createProfileFromTemplate($_POST['addprofile'], $_POST['addTemplate'], $_POST['addpassword']);
|
||||||
$_SESSION['conf_isAuthenticated'] = $_POST['addprofile'];
|
$_SESSION['conf_isAuthenticated'] = $_POST['addprofile'];
|
||||||
|
@ -88,12 +94,9 @@ if (isset($_POST['action'])) {
|
||||||
metaRefresh('confmain.php');
|
metaRefresh('confmain.php');
|
||||||
exit;
|
exit;
|
||||||
} catch (LAMException $e) {
|
} catch (LAMException $e) {
|
||||||
$error = $e->getTitle();
|
$error = $e->getTitle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
$error = _("Profile passwords are different or empty!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// rename profile
|
// rename profile
|
||||||
elseif ($_POST['action'] == "rename") {
|
elseif ($_POST['action'] == "rename") {
|
||||||
|
@ -131,20 +134,23 @@ if (isset($_POST['action'])) {
|
||||||
// set new profile password
|
// set new profile password
|
||||||
elseif ($_POST['action'] == "setpass") {
|
elseif ($_POST['action'] == "setpass") {
|
||||||
if (preg_match("/^[a-z0-9_-]+$/i", (string) $_POST['setprofile'])) {
|
if (preg_match("/^[a-z0-9_-]+$/i", (string) $_POST['setprofile'])) {
|
||||||
if ($_POST['setpassword'] && $_POST['setpassword2'] && ($_POST['setpassword'] == $_POST['setpassword2'])) {
|
if (empty($_POST['setpassword']) || ($_POST['setpassword'] !== $_POST['setpassword2'])) {
|
||||||
|
$error = _("Profile passwords are different or empty!");
|
||||||
|
}
|
||||||
|
elseif (!isValidConfigurationPassword($_POST['setpassword'])) {
|
||||||
|
$error = _('Please enter at least 8 characters including letters, a number and a symbol.');
|
||||||
|
}
|
||||||
|
else {
|
||||||
try {
|
try {
|
||||||
$config = $serverProfilePersistenceManager->loadProfile($_POST['setprofile']);
|
$config = $serverProfilePersistenceManager->loadProfile($_POST['setprofile']);
|
||||||
$config->set_Passwd($_POST['setpassword']);
|
$config->set_Passwd($_POST['setpassword']);
|
||||||
$serverProfilePersistenceManager->saveProfile($config, $_POST['setprofile']);
|
$serverProfilePersistenceManager->saveProfile($config, $_POST['setprofile']);
|
||||||
$msg = _("New password set successfully.");
|
$msg = _("New password set successfully.");
|
||||||
} catch (LAMException $e) {
|
} catch (LAMException $e) {
|
||||||
$error = $e->getTitle();
|
$error = $e->getTitle();
|
||||||
}
|
}
|
||||||
$config = null;
|
$config = null;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
$error = _("Profile passwords are different or empty!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$error = _("Profile name is invalid!");
|
$error = _("Profile name is invalid!");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue