X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Fhtml%2Fpassword.php;h=5aadb15a201d1687eda5d261fa54495a17062ee8;hb=1e902786fc6a29c7471f9e4650d11137b5a5a9e1;hp=6e3d205a3cb10bfe4f1db203243f5b85f8c414f9;hpb=e60652f21a826abf44ac947698d0dc9287396f3a;p=gosa.git diff --git a/gosa-core/html/password.php b/gosa-core/html/password.php index 6e3d205a3..5aadb15a2 100644 --- a/gosa-core/html/password.php +++ b/gosa-core/html/password.php @@ -1,21 +1,23 @@ data['MAIN']['DEBUGLEVEL']); +session::set('DEBUGLEVEL', $config->get_cfg_value("debuglevel")); if ($_SERVER["REQUEST_METHOD"] != "POST"){ @DEBUG (DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, "config"); } /* Set template compile directory */ -if (isset ($config->data['MAIN']['COMPILE'])){ - $smarty->compile_dir= $config->data['MAIN']['COMPILE']; -} else { - $smarty->compile_dir= '/var/spool/gosa'; -} +$smarty->compile_dir= $config->get_cfg_value("compile", '/var/spool/gosa'); /* Check for compile directory */ if (!(is_dir($smarty->compile_dir) && is_writable($smarty->compile_dir))){ - echo sprintf(_("Directory '%s' specified as compile directory is not accessible!"), - $smarty->compile_dir); - exit(); + msg_dialog::display(_("Configuration error"), sprintf(_("Directory '%s' specified as compile directory is not accessible!"), + $smarty->compile_dir), FATAL_ERROR_DIALOG); + exit; } /* Check for old files in compile directory */ clean_smarty_compile_dir($smarty->compile_dir); /* Language setup */ -if ($config->data['MAIN']['LANG'] == ""){ +if ($config->get_cfg_value("lang") == ""){ $lang= get_browser_language(); } else { - $lang= $config->data['MAIN']['LANG']; + $lang= $config->get_cfg_value("lang"); } $lang.=".UTF-8"; putenv("LANGUAGE="); @@ -146,19 +144,19 @@ if (!isset($_SERVER['HTTPS']) || } /* If SSL is forced, just forward to the SSL enabled site */ -if ($config->data['MAIN']['FORCESSL'] == 'true' && $ssl != ''){ +if ($config->get_cfg_value("forcessl") == 'true' && $ssl != ''){ header ("Location: $ssl"); exit; } /* Check for selected password method */ -$method= $config->current['HASH']; +$method= $config->get_cfg_value("hash", "crypt/md5"); if (isset($_GET['method'])){ $method= validate($_GET['method']); $tmp = new passwordMethod($config); $available = $tmp->get_available_methods(); if (!isset($available[$method])){ - echo _("Error: Password method not available!"); + msg_dialog::display(_("Password method"),_("Error: Password method not available!"),FATAL_ERROR_DIALOG); exit; } } @@ -195,28 +193,28 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['apply'])){ $message[]= _("The passwords you've entered as 'New password' and 'Repeated new password' do not match."); } else { if ($_POST['new_password'] == ""){ - $message[]= _("The password you've entered as 'New password' is empty."); + $message[]= msgPool::required(_("New password")); } } /* Password policy fulfilled? */ - if (isset($config->data['MAIN']['PWDIFFER'])){ - $l= $config->data['MAIN']['PWDIFFER']; + if ($config->get_cfg_value("pwdiffer") != ""){ + $l= $config->get_cfg_value("pwdiffer"); if (substr($_POST['current_password'], 0, $l) == substr($_POST['new_password'], 0, $l)){ $message[]= _("The password used as new and current are too similar."); } } - if (isset($config->data['MAIN']['PWMINLEN'])){ - if (strlen($_POST['new_password']) < $config->data['MAIN']['PWMINLEN']){ + if ($config->get_cfg_value("pwminlen") != ""){ + if (strlen($_POST['new_password']) < $config->get_cfg_value("pwminlen")){ $message[]= _("The password used as new is to short."); } } /* Validate */ - if (!ereg("^[A-Za-z0-9_.-]+$", $uid)){ - $message[]= _("Please specify a valid username!"); + if (!tests::is_uid($uid)){ + $message[]= msgPool::invalid(_("Login")); } elseif (mb_strlen($_POST["current_password"], 'UTF-8') == 0){ - $message[]= _("Please specify your password!"); + $message[]= msgPool::required(_("Current password")); } else { /* Do we have the selected user somewhere? */ @@ -235,13 +233,13 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['apply'])){ /* Do we need to show error messages? */ if (count ($message) != 0){ /* Show error message and continue editing */ - show_errors($message); + msg_dialog::displayChecks($message); } else { /* Passed quality check, just try to change the password now */ $output= ""; - if (isset($config->data['MAIN']['EXTERNALPWDHOOK'])){ - exec($config->data['MAIN']['EXTERNALPWDHOOK']." ".$ui->username." ". + if ($config->get_cfg_value("externalpwdhook") != ""){ + exec($config->get_cfg_value("externalpwdhook")." ".$ui->username." ". $_POST['current_password']." ".$_POST['new_password'], $resarr); if(count($resarr) > 0) { $output= join('\n', $resarr); @@ -249,7 +247,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['apply'])){ } if ($output != ""){ $message[]= _("External password changer reported a problem: ".$output); - show_errors($message); + msg_dialog::displayChecks($message); } else { if ($method != ""){ change_password ($ui->dn, $_POST['new_password'], 0, $method); @@ -278,7 +276,7 @@ $smarty->assign ('uid', $uid); $smarty->assign ('password_img', get_template_path('images/password.png')); /* Displasy SSL mode warning? */ -if ($ssl != "" && $config->data['MAIN']['WARNSSL'] == 'true'){ +if ($ssl != "" && $config->get_cfg_value("warnssl") == 'true'){ $smarty->assign ("ssl", ""._("Warning").": "._("Session will not be encrypted.")." "._("Enter SSL session")."!"); } else { $smarty->assign ("ssl", ""); @@ -296,6 +294,7 @@ if ($error_collector != ""){ $smarty->assign("php_errors", ""); } +$smarty->assign("msg_dialogs", msg_dialog::get_dialogs()); displayPWchanger(); ?>