Implement client session management and refactoring
This commit is contained in:
parent
cad2ea3419
commit
3a10e01bd8
11 changed files with 234 additions and 23 deletions
|
@ -4,6 +4,7 @@ namespace Socialbox\Objects\Database;
|
|||
|
||||
use DateTime;
|
||||
use Socialbox\Classes\Configuration;
|
||||
use Socialbox\Classes\Logger;
|
||||
use Socialbox\Enums\Status\CaptchaStatus;
|
||||
use Socialbox\Interfaces\SerializableInterface;
|
||||
|
||||
|
@ -56,14 +57,14 @@ class CaptchaRecord implements SerializableInterface
|
|||
return $this->created;
|
||||
}
|
||||
|
||||
public function getExpires(): DateTime
|
||||
public function getExpires(): int
|
||||
{
|
||||
return $this->created->modify(sprintf("+%s seconds", Configuration::getSecurityConfiguration()->getCaptchaTtl()));
|
||||
return $this->created->getTimestamp() + Configuration::getSecurityConfiguration()->getCaptchaTtl();
|
||||
}
|
||||
|
||||
public function isExpired(): bool
|
||||
{
|
||||
return $this->getExpires() < new DateTime();
|
||||
return time() > $this->getExpires();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue