diff --git a/www/account_manager/new_user.php b/www/account_manager/new_user.php
index 5bcde38..3045ffc 100644
--- a/www/account_manager/new_user.php
+++ b/www/account_manager/new_user.php
@@ -44,6 +44,8 @@ $weak_password = FALSE;
$invalid_email = FALSE;
$disabled_email_tickbox = TRUE;
$invalid_cn = FALSE;
+$invalid_givenname = FALSE;
+$invalid_sn = FALSE;
$invalid_account_identifier = FALSE;
$account_attribute = $LDAP['account_attribute'];
@@ -160,6 +162,8 @@ if (isset($_POST['create_account'])) {
if (!isset($this_cn) or $this_cn == "") { $invalid_cn = TRUE; }
if ((!isset($account_identifier) or $account_identifier == "") and $invalid_cn != TRUE) { $invalid_account_identifier = TRUE; }
+ if (!isset($this_givenname) or $this_givenname == "") { $invalid_givenname = TRUE; }
+ if (!isset($this_sn) or $this_sn == "") { $invalid_sn = TRUE; }
if ((!is_numeric($_POST['pass_score']) or $_POST['pass_score'] < 3) and $ACCEPT_WEAK_PASSWORDS != TRUE) { $weak_password = TRUE; }
if (isset($this_mail) and !is_valid_email($this_mail)) { $invalid_email = TRUE; }
if (preg_match("/\"|'/",$password)) { $invalid_password = TRUE; }
@@ -253,6 +257,8 @@ if (isset($_POST['create_account'])) {
$errors="";
if ($invalid_cn) { $errors.="
The Common Name is required\n"; }
+if ($invalid_givenname) { $errors.="First Name is required\n"; }
+if ($invalid_sn) { $errors.="Last Name is required\n"; }
if ($invalid_account_identifier) { $errors.="The account identifier (" . $attribute_map[$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"; }
@@ -358,6 +364,7 @@ $tabindex=1;
$label = $attr_r['label'];
if (isset($attr_r['onkeyup'])) { $onkeyup = $attr_r['onkeyup']; } else { $onkeyup = ""; }
if ($attribute == $LDAP['account_attribute']) { $label = "$label*"; }
+ if (isset($attr_r['required']) and $attr_r['required'] == TRUE) { $label = "$label*"; }
if (isset($$attribute)) { $these_values=$$attribute; } else { $these_values = array(); }
if (isset($attr_r['inputtype'])) { $inputtype = $attr_r['inputtype']; } else { $inputtype = ""; }
render_attribute_fields($attribute,$label,$these_values,"",$onkeyup,$inputtype,$tabindex);
diff --git a/www/includes/config.inc.php b/www/includes/config.inc.php
index c3d9263..36bf08e 100644
--- a/www/includes/config.inc.php
+++ b/www/includes/config.inc.php
@@ -21,12 +21,30 @@
$LDAP['account_attribute'] = (getenv('LDAP_ACCOUNT_ATTRIBUTE') ? getenv('LDAP_ACCOUNT_ATTRIBUTE') : 'uid');
$LDAP['account_objectclasses'] = array( 'person', 'inetOrgPerson', 'posixAccount' );
- $LDAP['default_attribute_map'] = array( "givenname" => array("label" => "First name", "onkeyup" => "update_username(); update_email(); update_cn(); update_homedir(); check_email_validity(document.getElementById('mail').value);"),
- "sn" => array("label" => "Last name", "onkeyup" => "update_username(); update_email(); update_cn(); update_homedir(); check_email_validity(document.getElementById('mail').value);"),
- "uid" => array("label" => "System username", "onkeyup" => "check_entity_name_validity(document.getElementById('uid').value,'uid_div'); update_email(); update_homedir(); check_email_validity(document.getElementById('mail').value);"),
- "cn" => array("label" => "Common name", "onkeyup" => "auto_cn_update = false;"),
- "mail" => array("label" => "Email", "onkeyup" => "auto_email_update = false; check_email_validity(document.getElementById('mail').value);")
- );
+ $LDAP['default_attribute_map'] = array(
+ "givenname" => array(
+ "label" => "First name",
+ "onkeyup" => "update_username(); update_email(); update_cn(); update_homedir(); check_email_validity(document.getElementById('mail').value);",
+ "required" => TRUE,
+ ),
+ "sn" => array(
+ "label" => "Last name",
+ "onkeyup" => "update_username(); update_email(); update_cn(); update_homedir(); check_email_validity(document.getElementById('mail').value);",
+ "required" => TRUE,
+ ),
+ "uid" => array(
+ "label" => "System username",
+ "onkeyup" => "check_entity_name_validity(document.getElementById('uid').value,'uid_div'); update_email(); update_homedir(); check_email_validity(document.getElementById('mail').value);",
+ ),
+ "cn" => array(
+ "label" => "Common name",
+ "onkeyup" => "auto_cn_update = false;",
+ ),
+ "mail" => array(
+ "label" => "Email",
+ "onkeyup" => "auto_email_update = false; check_email_validity(document.getElementById('mail').value);",
+ )
+ );
$LDAP['group_attribute'] = (getenv('LDAP_GROUP_ATTRIBUTE') ? getenv('LDAP_GROUP_ATTRIBUTE') : 'cn');
$LDAP['group_objectclasses'] = array( 'top', 'posixGroup' ); #groupOfUniqueNames is added automatically if rfc2307bis is available.