$attr_r) { if (isset($_POST[$attribute])) { $$attribute = filter_var($_POST[$attribute], FILTER_SANITIZE_STRING); } elseif (isset($attr_r['default'])) { $$attribute = $attr_r['default']; } $new_account_r[$attribute] = $$attribute; } ## if (isset($_GET['account_request'])) { $givenname=filter_var($_GET['first_name'], FILTER_SANITIZE_STRING); $new_account_r['givenname'] = $givenname; $sn=filter_var($_GET['last_name'], FILTER_SANITIZE_STRING); $new_account_r['sn'] = $sn; $uid = generate_username($first_name,$last_name); $new_account_r['uid'] = $uid; if ($ENFORCE_SAFE_SYSTEM_NAMES == TRUE) { $cn = "$givenname$sn"; } else { $cn = "$givenname $sn"; } $new_account_r['cn'] = $cn; $mail=filter_var($_GET['email'], FILTER_SANITIZE_EMAIL); if ($mail == "") { if (isset($EMAIL_DOMAIN)) { $mail = $uid . "@" . $EMAIL_DOMAIN; $disabled_email_tickbox = FALSE; } } else { $disabled_email_tickbox = FALSE; } $new_account_r['mail'] = $mail; } if (isset($_POST['create_account'])) { $password = $_POST['password']; $new_account_r['password'] = $password; $account_identifier = $new_account_r[$LDAP["account_attribute"]]; if (!isset($cn) or $cn == "") { $invalid_cn = TRUE; } if ((!isset($account_identifier) or $account_identifier == "") and $invalid_cn != TRUE) { $invalid_account_identifier = TRUE; } if ((!is_numeric($_POST['pass_score']) or $_POST['pass_score'] < 3) and $ACCEPT_WEAK_PASSWORDS != TRUE) { $weak_password = TRUE; } if (isset($mail) and !is_valid_email($mail)) { $invalid_email = TRUE; } if (preg_match("/\"|'/",$password)) { $invalid_password = TRUE; } if ($password != $_POST['password_match']) { $mismatched_passwords = TRUE; } if ($ENFORCE_SAFE_SYSTEM_NAMES == TRUE and !preg_match("/$POSIX_REGEX/",$account_identifier)) { $invalid_account_identifier = TRUE; } if (isset($_POST['send_email']) and isset($mail) and $EMAIL_SENDING_ENABLED == TRUE) { $send_user_email = TRUE; } if ( isset($givenname) and isset($sn) and isset($password) and !$mismatched_passwords and !$weak_password and !$invalid_password and !$invalid_account_identifier and !$invalid_cn and !$invalid_email) { $ldap_connection = open_ldap_connection(); $new_account = ldap_new_account($ldap_connection, $new_account_r); if ($new_account) { $creation_message = "The account was created."; if (isset($send_user_email) and $send_user_email == TRUE) { $mail_subject = "Your $ORGANISATION_NAME account has been created."; $mail_body = <<

Unfortunately adding it to the admin group failed.

Failed to create the account:

     
     
The Common Name is required\n"; } if ($invalid_account_identifier) { $errors.="
  • The account identifier (" . $attribute_map[$LDAP['account_attribute']]['label'] . ") is invalid.
  • \n"; } if ($weak_password) { $errors.="
  • The password is too weak
  • \n"; } if ($invalid_password) { $errors.="
  • The password contained invalid characters
  • \n"; } if ($invalid_email) { $errors.="
  • The email address is invalid
  • \n"; } if ($mismatched_passwords) { $errors.="
  • The passwords are mismatched
  • \n"; } if ($invalid_username) { $errors.="
  • The username is invalid
  • \n"; } if ($errors != "") { ?>

    There were issues creating the account:

    $attr_r) { $label = $attr_r['label']; $onkeyup = $attr_r['onkeyup']; if ($attribute == $LDAP['account_attribute']) { $label = "$label*"; } ?>
    >
    > Email these credentials to the user?
    *The account identifier