mango r179 - in trunk: . lib www



Author: ovitters
Date: Sun Jun  1 00:32:36 2008
New Revision: 179
URL: http://svn.gnome.org/viewvc/mango?rev=179&view=rev

Log:
	* lib/mysql.php: Avoid notice when password is empty.
	* lib/user.php:
	* www/update_user.php: Complain loudly if user wasn't updated due to
	validation errors.



Modified:
   trunk/ChangeLog
   trunk/lib/mysql.php
   trunk/lib/user.php
   trunk/www/update_user.php

Modified: trunk/lib/mysql.php
==============================================================================
--- trunk/lib/mysql.php	(original)
+++ trunk/lib/mysql.php	Sun Jun  1 00:32:36 2008
@@ -16,7 +16,7 @@
         $hostname = $url_parts['host'];
         # $scheme = $url_parts['scheme']; -- we don't care about the scheme, only support MySQL for now
         $login = $url_parts['user'];
-        $passwd = $url_parts['pass'];
+        $passwd = empty($url_parts['pass']) ? '' : $url_parts['pass'];
         $dbname = substr($url_parts['path'], 1);
 
         /* Connect to the LDAP server */

Modified: trunk/lib/user.php
==============================================================================
--- trunk/lib/user.php	(original)
+++ trunk/lib/user.php	Sun Jun  1 00:32:36 2008
@@ -34,7 +34,7 @@
         $user->uid = $entry['uid'][0];
         $user->cn = $entry['cn'][0];
         $user->mail = $entry['mail'][0];
-        $user->homeDirectory = $entry['homeDirectory'][0];
+        $user->homeDirectory = $entry['homedirectory'][0];
         $user->description = $entry['description'][0];
         if(count($entry['authorizedkey']) > 0) {
             for($i = 0; $i < $entry['authorizedkey']['count']; $i++) {
@@ -255,7 +255,7 @@
 
         // What's changed with the SSH keys?
         $removedkeys = array_diff($olduser->authorizedKeys, $this->authorizedKeys);
-        $result = $this->_update_sshkey($ldap, $dn, $olduser, $user, false, $removedkeys, $changes, 'key-del', 'keysremoved');
+        $result = $this->_update_sshkey($ldap, $dn, $olduser, false, $removedkeys, $changes, 'key-del', 'keysremoved');
         if(PEAR::isError($result)) return $result;
 
         $newkeys = array_diff($this->authorizedKeys, $olduser->authorizedKeys);

Modified: trunk/www/update_user.php
==============================================================================
--- trunk/www/update_user.php	(original)
+++ trunk/www/update_user.php	Sun Jun  1 00:32:36 2008
@@ -132,6 +132,9 @@
                 $formerrors = $this->user->validate();
 
                 if(count($formerrors) > 0) {
+                    $node = $formnode->appendChild($dom->createElement("error"));
+                    $node->appendChild($dom->createTextNode('User not updated! Correct the fields marked red.'));
+
                     foreach($formerrors as $error) {
                         $node = $formnode->appendChild($dom->createElement("formerror"));
                         $node->setAttribute("type", $error);
@@ -193,7 +196,7 @@
             $newkeys .= file_get_contents($_FILES['keyfile']['tmp_name']);
         }
         $newkeys .= "\n".$_POST['newkeys'];
-        $newkeys = split("\n", $newkeylist);
+        $newkeys = split("\n", $newkeys);
         foreach($newkeys as $key) {
             if(empty($key) || substr($key, 0, 3) != "ssh") continue;
             $this->user->authorizedKeys[] = $key;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]