Example #1
0
        default:
            $message = $_REQUEST['message'];
    }
}
/* Got a formular answer, validate and try to log in */
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['login'])) {
    /* Reset error messages */
    $message = "";
    /* Destroy old sessions, they cause a successfull login to relog again ...*/
    if (session::global_is_set('_LAST_PAGE_REQUEST')) {
        session::global_set('_LAST_PAGE_REQUEST', time());
    }
    /* Admin-logon and verify */
    $ldap = $config->get_ldap_link();
    if (is_null($ldap) || is_int($ldap) && $ldap == 0) {
        msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()), LDAP_ERROR);
        displayLogin();
        exit;
    }
    /* Check for schema file presence */
    if ($config->get_cfg_value("schemaCheck") == "TRUE") {
        $recursive = $config->get_cfg_value("ldapFollowReferrals") == "TRUE";
        $tls = $config->get_cfg_value("ldapTLS") == "TRUE";
        if (!count($ldap->get_objectclasses())) {
            msg_dialog::display(_("LDAP error"), _("Cannot detect information about the installed LDAP schema!"), ERROR_DIALOG);
            displayLogin();
            exit;
        } else {
            $cfg = array();
            $cfg['admin'] = $config->current['ADMINDN'];
            $cfg['password'] = $config->current['ADMINPASSWORD'];
Example #2
0
     session::global_set('_LAST_PAGE_REQUEST', time());
 }
 // Get posted values
 $current_password = get_post('current_password');
 $new_password = get_post('new_password');
 $repeated_password = get_post('new_password_repeated');
 // Get configuration flags for further input checks.
 $check_differ = $config->get_cfg_value("core", "passwordMinDiffer") != "";
 $differ = $config->get_cfg_value("core", "passwordMinDiffer");
 $check_length = $config->get_cfg_value("core", "passwordMinLength") != "";
 $length = $config->get_cfg_value("core", "passwordMinLength");
 // Once an error has occured it is stored here.
 $message = array();
 // Perform GOsa password policy checks
 if (!tests::is_uid($uid)) {
     $message[] = msgPool::invalid(_("Login"));
 } elseif (empty($current_password)) {
     $message[] = _("You need to specify your current password in order to proceed.");
 } elseif ($new_password != $repeated_password) {
     $message[] = _("The passwords you've entered as 'New password' and 'Repeated new password' do not match.");
 } elseif ($new_password == "") {
     $message[] = _("The password you've entered as 'New password' is empty.");
 } elseif ($check_differ && substr($current_password, 0, $differ) == substr($new_password, 0, $differ)) {
     $message[] = _("The password used as new and current are too similar.");
 } elseif ($check_length && strlen($new_password) < $length) {
     $message[] = _("The password used as new is to short.");
 } elseif (!passwordMethod::is_harmless($new_password)) {
     $message[] = _("The password contains possibly problematic Unicode characters!");
 }
 // Connect as the given user and load its ACLs
 if (!count($message)) {