steffen: server/kolab/kolab/admin/user create_user.php,1.12,1.13

cvs at intevation.de cvs at intevation.de
Sun Apr 4 18:06:10 CEST 2004


Author: steffen

Update of /kolabrepository/server/kolab/kolab/admin/user
In directory doto:/tmp/cvs-serv13408/kolab/kolab/admin/user

Modified Files:
	create_user.php 
Log Message:
hopefully fixed issue6

Index: create_user.php
===================================================================
RCS file: /kolabrepository/server/kolab/kolab/admin/user/create_user.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- create_user.php	28 Nov 2003 02:01:04 -0000	1.12
+++ create_user.php	4 Apr 2004 16:06:08 -0000	1.13
@@ -13,7 +13,7 @@
 
 <?
 function debug ($a) {
-//   print "debug: $a<br>\n";
+   print "debug: $a<br>\n";
 }
 
 debug("debug is on");
@@ -93,8 +93,10 @@
 function fill_up($a)
 {
    global $attributes;
+   global $action;
    foreach ($attributes as $attr) {
       if ($attr == 'uid' || $attr == 'mail') continue;
+      if ($attr == 'userPassword' && $action != "firstsave" ) continue;
       if (empty($a[$attr])) $a[$attr] = array();
    }
    return $a;
@@ -129,14 +131,16 @@
 }
 
 if ($action == "create") {
-  $comment_mail_0 = 'Required, non volatile' ; }
-else {
+  $comment_mail_0 = 'Required, non volatile' ; 
+  $comment_password = 'Required';
+} else {
   $comment_mail_0 = 'non volatile' ;
+  $comment_password = 'Leave blank to keep password unchanged';
 }
 
 $comment = array(
    'firstname' => 'Required', 'sn_0' => 'Required',
-   'password_0' => 'Required', 'password_1' => 'Required',
+   'password_0' => $comment_password, 'password_1' => $comment_password,
    'mail_0' => $comment_mail_0,
    'visible' => 'check here to make this users address <br> visible in the address book');
 
@@ -243,6 +247,14 @@
               $comment['mail_0'] = "<span class=\"warning\"> Fill in valid email address</span>";
 	       missing_input();
             }
+	    if ( empty($HTTP_GET_VARS['password_0'])) {
+               $comment['password_0'] = "<span class=\"warning\"> Fill in password </span>";
+               missing_input();
+	    }
+            if (empty($HTTP_GET_VARS['password_1'])) {
+               $comment['password_1'] = "<span class=\"warning\"> Fill in password </span>";
+               missing_input();
+            }
 
          case "save":
             if ($action == "save" && !$dn) array_push($errors, "Internal Error: need dn to save");
@@ -262,16 +274,8 @@
                }
 	    }   
             if (!empty($HTTP_GET_VARS['password_0'])) $password_0 = urldecode($HTTP_GET_VARS['password_0']);
-            else {
-               $comment['password_0'] = "<span class=\"warning\"> Fill in password </span>";
-               missing_input();
-            }
             if (!empty($HTTP_GET_VARS['password_1'])) $password_1 = urldecode($HTTP_GET_VARS['password_1']);
-            else {
-               $comment['password_1'] = "<span class=\"warning\"> Fill in password </span>";
-               missing_input();
-            }
-            if ($password_0 && $password_1) {
+            if ($password_0 && $password_1 ) {
                if ($password_0 == $password_1) {
                   $ldap_object['userPassword'] = '{sha}'.base64_encode(pack("H*", sha1($password_0)));
                } else {
@@ -439,8 +443,10 @@
 }
 
 if ($action != "delete") {
-   if (is_array($ldap_object['userPassword'])) $password_0 = $password_1 = $ldap_object['userPassword'][0];
+  /*if (is_array($ldap_object['userPassword'])) $password_0 = $password_1 = $ldap_object['userPassword'][0];
       else $password_0 = $password_1 = $ldap_object['userPassword'];
+  */
+   $password_0 = $password_1 = '';
    print "<tr><td> Password </td><td>\n";
    print "<input type=\"password\" name=\"password_0\" size=$width maxlength=80 value=\"$password_0\">\n";
    print "</td><td>".(comment('password_0'))."</td></tr>\n";





More information about the commits mailing list