Cookie-based login initially done
[shipsimu.git] / application / ship-simu / main / login / class_ShipSimuUserLogin.php
index a043de8ba74c0ed28cedc5ab4621ebdcd608ab6c..59ddcdcb6b9f8619191dbabb3aeb1732281d0aaa 100644 (file)
@@ -61,6 +61,7 @@ class ShipSimuUserLogin extends BaseFrameworkSystem implements LoginableUser {
         * in a boolean attribute which is then readable by a matching getter.
         *
         * @param       $requestInstance        An instance of a Requestable class
+        * @param       $responseInstance       An instance of a Responseable class
         * @return      void
         * @throws      UserLoginMethodException        If wether username nor email login
         *                                                                              was detected
@@ -69,7 +70,7 @@ class ShipSimuUserLogin extends BaseFrameworkSystem implements LoginableUser {
         * @throws      UserPasswordMismatchException   If the supplied password did not
         *                                                                              match with the stored password
         */
-       public function doLogin (Requestable $requestInstance) {
+       public function doLogin (Requestable $requestInstance, Responseable $responseInstance) {
                // By default no method is selected
                $method = null;
                $data = "";
@@ -118,7 +119,20 @@ class ShipSimuUserLogin extends BaseFrameworkSystem implements LoginableUser {
                $helperInstance = ObjectFactory::createObjectByConfiguredName('login_helper', array($requestInstance));
 
                // 2) Execute the login. This will now login...
-               $helperInstance->executeLogin();
+               $helperInstance->executeLogin($responseInstance);
+       }
+
+       /**
+        * Determines wether the login was fine. This is done by checking if the 'login' instance is in registry
+        *
+        * @return      $loginDone      Wether the login was fine or not
+        */
+       public function ifLoginWasSuccessfull () {
+               // Is the registry key there?
+               $loginDone = (Registry::getRegistry()->getInstance('login') instanceof Registerable);
+
+               // Return the result
+               return $loginDone;
        }
 }