Elgg\PersistentLoginService::removePersistentLogin PHP Method

removePersistentLogin() public method

Remove the persisted login token from client and server
public removePersistentLogin ( ) : void
return void
    public function removePersistentLogin()
    {
        if ($this->cookie_token) {
            $client_hash = $this->hashToken($this->cookie_token);
            $this->removeHash($client_hash);
        }
        $this->setCookie("");
        $this->setSession("");
    }

Usage Example

Example #1
0
 function testRemoveWithoutCookieCantDeleteHash()
 {
     $this->dbMock->expects($this->never())->method('deleteData');
     $this->svc->removePersistentLogin();
     $this->assertSame('', $this->lastCookieSet->value);
     $this->assertSame($this->thirtyDaysAgo, $this->lastCookieSet->expire);
     $this->assertNull($this->session->get('code'));
 }