]> git.mxchange.org Git - shipsimu.git/blobdiff - application/shipsimu/main/login/class_ShipSimuGuestLogin.php
Cleanup of old stuff.
[shipsimu.git] / application / shipsimu / main / login / class_ShipSimuGuestLogin.php
index 16f76ed73a57fa82a87035e9caa4e4b074f03b87..97254495c9d185b027abcb8ae55f762bbe3a58ee 100644 (file)
@@ -21,7 +21,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-class ShipSimuGuestLogin extends BaseFrameworkSystem implements LoginableUser {
+class ShipSimuGuestLogin extends BaseFrameworkSystem implements LoginableUser, Registerable {
        /**
         * The hashed password
         */
@@ -58,36 +58,12 @@ class ShipSimuGuestLogin extends BaseFrameworkSystem implements LoginableUser {
         * @param       $requestInstance        An instance of a Requestable class
         * @param       $responseInstance       An instance of a Responseable class
         * @return      void
-        * @throws      UserAuthMethodException If wether username nor email login
-        *                                                                              was detected
-        * @throws      MissingMethodException          If a method was not found in the
-        *                                                                              User class
         * @throws      UserPasswordMismatchException   If the supplied password did not
         *                                                                              match with the stored password
         */
        public function doLogin (Requestable $requestInstance, Responseable $responseInstance) {
-               // By default no method is selected
-               $method = null;
-               $data = "";
-
-               // Detect login method (username or email) and try to get a userinstance
-               if (!is_null($requestInstance->getRequestElement('user'))) {
-                       // Username found!
-                       $method = 'createGuestByUsername';
-                       $data = $requestInstance->getRequestElement('user');
-               } // END - if
-
-               // Is a method detected?
-               if (is_null($method)) {
-                       // Then abort here
-                       throw new UserAuthMethodException($this, self::EXCEPTION_MISSING_METHOD);
-               } elseif (!method_exists($this->getConfigInstance()->getConfigEntry('guest_class'), $method)) {
-                       // The method is invalid!
-                       throw new MissingMethodException(array($this, $method), self::EXCEPTION_MISSING_METHOD);
-               }
-
                // Get a user instance
-               $userInstance = call_user_func_array(array($this->getConfigInstance()->getConfigEntry('guest_class'), $method), array($data));
+               $userInstance = LoginFactory::createLoginObjectByRequest($requestInstance);
 
                // Remember this new instance in registry
                Registry::getRegistry()->addInstance('user', $userInstance);