]> git.mxchange.org Git - shipsimu.git/blobdiff - application/ship-simu/main/registration/class_ShipSimuRegistration.php
Comments fixed... ;) And pre/post filters for registrations now supported
[shipsimu.git] / application / ship-simu / main / registration / class_ShipSimuRegistration.php
index dd5ef73d611210d964ac2573b9e053b4b979d5f8..252d05df20457e27e37311af7fe3ff711db0c5ea 100644 (file)
  */
 class ShipSimuRegistration extends BaseRegistration {
        /**
-        * Private constructor
+        * Hashed password
+        */
+       private $hashedPassword = "";
+
+       /**
+        * Protected constructor
         *
         * @return      void
         */
@@ -47,19 +52,32 @@ class ShipSimuRegistration extends BaseRegistration {
                // Get a new instance
                $registrationInstance = new ShipSimuRegistration();
 
+               // Initialize the filter chains
+               $registrationInstance->initFilterChains();
+
                // And return it
                return $registrationInstance;
        }
 
        /**
-        * Encrypt the given request key or throws an exception if the key was not
+        * Encrypt the given request key or throw an exception if the key was not
         * found in the request
         *
         * @param       $requestKey             Key in request class
         * @return      void
         */
        public function encryptPassword ($requestKey) {
-               $this->partialStub(sprintf("requestKey=%s", $requestKey));
+               // Check if the password is found in the request
+               if ($this->getRequestInstance()->isRequestElementSet($requestKey)) {
+                       // So encrypt the password and store it for later usage in
+                       // the request:
+                       // 1.: Get the plain password
+                       $plainPassword = $this->getRequestInstance()->getRequestElement($requestKey);
+                       // 2. Get a crypto helper and hash the password
+                       $this->hashedPassword = ObjectFactory::createObjectByConfiguredName('crypto_heler')->hashPassword($plainPassword);
+                       // 3. Store the hash back in the request
+                       $this->getRequestInstance()->setRequestElement('pass_hash', $this->hashedPassword);
+               }
        }
 
        /**
@@ -69,7 +87,8 @@ class ShipSimuRegistration extends BaseRegistration {
         * @return      void
         */
        public function doPreRegistration () {
-               $this->partialStub();
+               // First run all pre filters
+               $this->executePreFilters();
        }
 
        /**
@@ -88,7 +107,8 @@ class ShipSimuRegistration extends BaseRegistration {
         * @return      void
         */
        public function doPostRegistration () {
-               $this->partialStub();
+               // First run all post filters
+               $this->executePostFilters();
        }
 
        /**