|
|
|
@ -139,20 +139,17 @@ class LoginTest extends CIDatabaseTestCase
|
|
|
|
|
$session = $this->getInstance(); |
|
|
|
|
$this->library = new Aauth(null, $session); |
|
|
|
|
$config = new AauthConfig(); |
|
|
|
|
$expire = $config->loginRemember; |
|
|
|
|
$userId = base64_encode(1); |
|
|
|
|
$randomString = random_string('alnum', 32); |
|
|
|
|
$selectorString = random_string('alnum', 16); |
|
|
|
|
|
|
|
|
|
$this->response->setCookie('remember', $userId . ';' . $randomString . ';' . $selectorString, YEAR); |
|
|
|
|
$_COOKIE['remember'] = base64_encode(1) . ';' . $randomString . ';' . $selectorString; |
|
|
|
|
|
|
|
|
|
$this->hasInDatabase($config->dbTableLoginTokens, [ |
|
|
|
|
'user_id' => 1, |
|
|
|
|
'random_hash' => password_hash($randomString, PASSWORD_DEFAULT), |
|
|
|
|
'selector_hash' => password_hash($selectorString, PASSWORD_DEFAULT), |
|
|
|
|
'expires_at' => date('Y-m-d H:i:s', strtotime($expire)), |
|
|
|
|
'expires_at' => date('Y-m-d H:i:s', strtotime('+1 week')), |
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
$this->assertTrue($this->library->isLoggedIn()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|