Add purge for login
This commit is contained in:
parent
a41b190cc2
commit
75983ebb4b
|
@ -106,6 +106,13 @@ class Api
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function freshLogin(int $mglnr, string $password): self
|
||||||
|
{
|
||||||
|
$this->authenticator->purge();
|
||||||
|
|
||||||
|
return $this->login($mglnr, $password);
|
||||||
|
}
|
||||||
|
|
||||||
public function isLoggedIn(): bool
|
public function isLoggedIn(): bool
|
||||||
{
|
{
|
||||||
return $this->authenticator->isLoggedIn();
|
return $this->authenticator->isLoggedIn();
|
||||||
|
|
|
@ -8,6 +8,8 @@ abstract class Authenticator
|
||||||
{
|
{
|
||||||
abstract public function login(int $mglnr, string $password): self;
|
abstract public function login(int $mglnr, string $password): self;
|
||||||
|
|
||||||
|
abstract public function purge(): void;
|
||||||
|
|
||||||
abstract public function http(): PendingRequest;
|
abstract public function http(): PendingRequest;
|
||||||
|
|
||||||
abstract public function isLoggedIn(): bool;
|
abstract public function isLoggedIn(): bool;
|
||||||
|
|
|
@ -72,6 +72,10 @@ class FakeCookie extends Authenticator
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function purge(): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public function refresh(): void
|
public function refresh(): void
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,13 @@ class MainCookie extends Authenticator
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function purge(): void
|
||||||
|
{
|
||||||
|
while ($this->file()) {
|
||||||
|
unlink($this->file());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function isLoggedIn(): bool
|
public function isLoggedIn(): bool
|
||||||
{
|
{
|
||||||
if (null === $this->file()) {
|
if (null === $this->file()) {
|
||||||
|
|
Loading…
Reference in New Issue