]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/auth/class_CookieAuth.php
Rewrite continued:
[core.git] / framework / main / classes / auth / class_CookieAuth.php
index a98999f4c954eb7d7936d98db081612894b9e311..f1c38e4098e7fa8b47814c0a40b786082ea1dea1 100644 (file)
@@ -3,6 +3,7 @@
 namespace CoreFramework\Auth;
 
 // Import framework stuff
+use CoreFramework\Bootstrap\FrameworkBootstrap;
 use CoreFramework\Object\BaseFrameworkSystem;
 use CoreFramework\Registry\Registerable;
 use CoreFramework\Response\Responseable;
@@ -50,9 +51,6 @@ class CookieAuth extends BaseFrameworkSystem implements Authorizeable, Registera
                // Get a new instance
                $loginInstance = new CookieAuth();
 
-               // Set the response instance
-               $loginInstance->setResponseInstance($responseInstance);
-
                // Return the prepared instance
                return $loginInstance;
        }
@@ -64,7 +62,7 @@ class CookieAuth extends BaseFrameworkSystem implements Authorizeable, Registera
         * @return      void
         */
        public function setUserAuth ($userName) {
-               $this->getResponseInstance()->addCookie('username', $userName);
+               FrameworkBootstrap::getResponseInstance()->addCookie('username', $userName);
        }
 
        /**
@@ -74,7 +72,7 @@ class CookieAuth extends BaseFrameworkSystem implements Authorizeable, Registera
         * @return      void
         */
        public function setPasswordAuth ($passHash) {
-               $this->getResponseInstance()->addCookie('u_hash', $passHash);
+               FrameworkBootstrap::getResponseInstance()->addCookie('u_hash', $passHash);
        }
 
        /**
@@ -84,7 +82,7 @@ class CookieAuth extends BaseFrameworkSystem implements Authorizeable, Registera
         */
        public function getUserAuth () {
                // Get the username from cookie
-               $userName = $this->getRequestInstance()->readCookie('username');
+               $userName = FrameworkBootstrap::getRequestInstance()->readCookie('username');
 
                // Return the username
                return $userName;
@@ -97,7 +95,7 @@ class CookieAuth extends BaseFrameworkSystem implements Authorizeable, Registera
         */
        public function getPasswordAuth () {
                // Get the username from cookie
-               $passHash = $this->getRequestInstance()->readCookie('u_hash');
+               $passHash = FrameworkBootstrap::getRequestInstance()->readCookie('u_hash');
 
                // Return the username
                return $passHash;
@@ -110,8 +108,8 @@ class CookieAuth extends BaseFrameworkSystem implements Authorizeable, Registera
         */
        public function destroyAuthData () {
                // Expire both cookies
-               $this->getResponseInstance()->expireCookie('username');
-               $this->getResponseInstance()->expireCookie('u_hash');
+               FrameworkBootstrap::getResponseInstance()->expireCookie('username');
+               FrameworkBootstrap::getResponseInstance()->expireCookie('u_hash');
        }
 
        /**
@@ -120,8 +118,8 @@ class CookieAuth extends BaseFrameworkSystem implements Authorizeable, Registera
         * @return      void
         */
        public function updateAuthData () {
-               $this->getResponseInstance()->refreshCookie('username');
-               $this->getResponseInstance()->refreshCookie('u_hash');
+               FrameworkBootstrap::getResponseInstance()->refreshCookie('username');
+               FrameworkBootstrap::getResponseInstance()->refreshCookie('u_hash');
        }
 
 }