User class / resending of confirm link updated:
[shipsimu.git] / inc / classes / main / user / class_BaseUser.php
index e9ce25c3f45061a9b66c7361fc2372ab5960d8ee..cee4fc31d628d8b2c00cb39414c7554f95a1e8a7 100644 (file)
@@ -187,6 +187,15 @@ class BaseUser extends BaseFrameworkSystem {
                if ($this->getResultInstance()->next()) {
                        // Entry found
                        $exists = true;
+
+                       // Is the username set?
+                       if ($this->getUserName() == "") {
+                               // Get current entry
+                               $currEntry = $this->getResultInstance()->current();
+
+                               // Set the username
+                               $this->setUserName($currEntry['username']);
+                       } // END - if
                } // END - if
 
                // Return the status
@@ -258,14 +267,23 @@ class BaseUser extends BaseFrameworkSystem {
         *
         * @param       $fieldName              Field name which we shall get
         * @return      $fieldValue             Field value from the user
-        * @todo        Do we need to secure this here against missing results?
+        * @throws      NullPointerException    If the result instance is null
         */
        public final function getField ($fieldName) {
                // Default field value
                $fieldValue = null;
 
+               // Get result instance
+               $resultInstance = $this->getResultInstance();
+
+               // Is this instance null?
+               if (is_null($resultInstance)) {
+                       // Then the user instance is no longer valid (expired cookies?)
+                       throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
+               } // END - if
+
                // Get current array
-               $fieldArray = $this->getResultInstance()->current();
+               $fieldArray = $resultInstance->current();
 
                // Does the field exist?
                if (isset($fieldArray[$fieldName])) {