namespace CoreFramework\Auth;
// Import framework stuff
+use CoreFramework\Bootstrap\FrameworkBootstrap;
use CoreFramework\Object\BaseFrameworkSystem;
use CoreFramework\Registry\Registerable;
use CoreFramework\Response\Responseable;
// Get a new instance
$loginInstance = new CookieAuth();
- // Set the response instance
- $loginInstance->setResponseInstance($responseInstance);
-
// Return the prepared instance
return $loginInstance;
}
* @return void
*/
public function setUserAuth ($userName) {
- $this->getResponseInstance()->addCookie('username', $userName);
+ FrameworkBootstrap::getResponseInstance()->addCookie('username', $userName);
}
/**
* @return void
*/
public function setPasswordAuth ($passHash) {
- $this->getResponseInstance()->addCookie('u_hash', $passHash);
+ FrameworkBootstrap::getResponseInstance()->addCookie('u_hash', $passHash);
}
/**
*/
public function getUserAuth () {
// Get the username from cookie
- $userName = $this->getRequestInstance()->readCookie('username');
+ $userName = FrameworkBootstrap::getRequestInstance()->readCookie('username');
// Return the username
return $userName;
*/
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;
*/
public function destroyAuthData () {
// Expire both cookies
- $this->getResponseInstance()->expireCookie('username');
- $this->getResponseInstance()->expireCookie('u_hash');
+ FrameworkBootstrap::getResponseInstance()->expireCookie('username');
+ FrameworkBootstrap::getResponseInstance()->expireCookie('u_hash');
}
/**
* @return void
*/
public function updateAuthData () {
- $this->getResponseInstance()->refreshCookie('username');
- $this->getResponseInstance()->refreshCookie('u_hash');
+ FrameworkBootstrap::getResponseInstance()->refreshCookie('username');
+ FrameworkBootstrap::getResponseInstance()->refreshCookie('u_hash');
}
}