[pLog-svn] r5792 - plog/trunk/class/action/admin

oscar at devel.lifetype.net oscar at devel.lifetype.net
Sun Aug 5 06:53:20 EDT 2007


Author: oscar
Date: 2007-08-05 06:53:20 -0400 (Sun, 05 Aug 2007)
New Revision: 5792

Modified:
   plog/trunk/class/action/admin/adminadduseraction.class.php
Log:
Small fix for improved error reporting.

Modified: plog/trunk/class/action/admin/adminadduseraction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminadduseraction.class.php	2007-08-05 07:37:49 UTC (rev 5791)
+++ plog/trunk/class/action/admin/adminadduseraction.class.php	2007-08-05 10:53:20 UTC (rev 5792)
@@ -53,10 +53,29 @@
 			$this->requireAdminPermission( "add_user" );
         }
 
+		function validate()
+		{	
+			if( !parent::validate())
+				return( false );
+				
+        	// now that we have validated the data, we can proceed to create the user, making
+            // sure that it doesn't already exist
+        	$this->_userName = $this->_request->getFilteredValue( "userName", new HtmlFilter());
+            $users = new Users();
+			$valid = true;
+            $userInfo = $users->getUserInfoFromUsername( $this->_userName );
+            if( $userInfo ) {
+                $this->_form->setFieldValidationStatus( "userName", false );
+				$this->validationErrorProcessing();
+				$valid = false;
+            }
+
+			return( $valid );
+		}
+
 		private function addUser()
 		{
 	        // fetch the validated data
-        	$this->_userName = $this->_request->getFilteredValue( "userName", new HtmlFilter());
             $this->_userPassword = $this->_request->getValue( "newUserPassword" );
             $this->_userEmail = $this->_request->getFilteredValue( "userEmail", new HtmlFilter());
             $this->_userFullName = $this->_request->getFilteredValue( "userFullName", new HtmlFilter());
@@ -64,18 +83,8 @@
 			$this->_userBlog = $this->_request->getValue( "blogId" );
 			$this->_permissions = $this->_request->getValue( "userPermissions" );
 	        
-        	// now that we have validated the data, we can proceed to create the user, making
-            // sure that it doesn't already exist
-            $users = new Users();
-            $userInfo = $users->getUserInfoFromUsername( $this->_userName );
-            if( $userInfo ) {
-                $this->_form->setFieldValidationStatus( "userName", false );
-                //$this->_view = new AdminAddUserView( $this->_blogInfo );
-                //$this->setCommonData( true );
-                return false;
-            }
-
             // otherwise, we can create a new one
+			$users = new Users();
 			$user = new UserInfo( $this->_userName, 
 			                      $this->_userPassword, 
 								  $this->_userEmail, 



More information about the pLog-svn mailing list