]> git.mxchange.org Git - shipsimu.git/blobdiff - application/ship-simu/main/commands/web/class_WebShipsimuRegisterCommand.php
Guest login basicly supported (not finished yet!)
[shipsimu.git] / application / ship-simu / main / commands / web / class_WebShipsimuRegisterCommand.php
index 0b41b4fe913e08c03e92cdba110eb77144756479..035991df0644fb10211f46eb68c8bf4ed83f45c5 100644 (file)
@@ -23,7 +23,7 @@
  */
 class WebShipsimuRegisterCommand extends BaseCommand implements Commandable {
        /**
-        * Private constructor
+        * Protected constructor
         *
         * @return      void
         */
@@ -35,7 +35,7 @@ class WebShipsimuRegisterCommand extends BaseCommand implements Commandable {
                $this->setObjectDescription("Registration handling command for Ship-Simu");
 
                // Create unique ID number
-               $this->createUniqueID();
+               $this->generateUniqueId();
 
                // Clean up a little
                $this->removeNumberFormaters();
@@ -58,8 +58,12 @@ class WebShipsimuRegisterCommand extends BaseCommand implements Commandable {
                // Get the controller instance from the resolver (breaks MVC pattern again)
                $controllerInstance = $resolverInstance->getControllerInstance();
 
-               // @TODO Add some more pre/post filters to the controller
-               $controllerInstance->addPreFilter(UserNameValidatorFilter::createUserNameValidatorFilter());
+               /* @TODO Add some more pre/post filters to the controller */
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_validator_class'));
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_validator_class'));
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_is_guest_class'));
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_validator_class'));
+               $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('rules_accepted_class'));
 
                // Return the prepared instance
                return $commandInstance;
@@ -73,7 +77,28 @@ class WebShipsimuRegisterCommand extends BaseCommand implements Commandable {
         * @return      void
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
-               $this->partialStub();
+               // First get a UserRegistration instance
+               $registerInstance = ObjectFactory::createObjectByConfiguredName('user_registration_class');
+
+               // First set request and response instance
+               $registerInstance->setRequestInstance($requestInstance);
+               $registerInstance->setResponseInstance($responseInstance);
+
+               // Encrypt the password
+               $registerInstance->encryptPassword('pass1');
+
+               // Do things before registration
+               $registerInstance->doPreRegistration();
+
+               // Register the new user
+               $registerInstance->registerNewUser();
+
+               // Do things after registration like notifying partner pages or queueing
+               // them for notification
+               $registerInstance->doPostRegistration();
+
+               // Redirect or login after registration
+               $registerInstance->doPostAction();
        }
 }