Add support for Privacy Policy, Terms of Service, and CAPTCHA
This commit is contained in:
parent
756297671f
commit
c866e2f696
22 changed files with 795 additions and 138 deletions
|
@ -10,7 +10,9 @@
|
|||
use Socialbox\Enums\Types\RequestType;
|
||||
use Socialbox\Exceptions\CryptographyException;
|
||||
use Socialbox\Exceptions\RequestException;
|
||||
use Socialbox\Managers\RegisteredPeerManager;
|
||||
use Socialbox\Managers\SessionManager;
|
||||
use Socialbox\Objects\Database\RegisteredPeerRecord;
|
||||
use Socialbox\Objects\Database\SessionRecord;
|
||||
|
||||
class ClientRequest
|
||||
|
@ -113,6 +115,18 @@
|
|||
return SessionManager::getSession($this->sessionUuid);
|
||||
}
|
||||
|
||||
public function getPeer(): ?RegisteredPeerRecord
|
||||
{
|
||||
$session = $this->getSession();
|
||||
|
||||
if($session === null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return RegisteredPeerManager::getPeer($session->getPeerUuid());
|
||||
}
|
||||
|
||||
public function getSignature(): ?string
|
||||
{
|
||||
return $this->signature;
|
||||
|
|
|
@ -81,4 +81,20 @@
|
|||
{
|
||||
return $this->updated;
|
||||
}
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'peer_uuid' => $this->peerUuid,
|
||||
'iv' => $this->iv,
|
||||
'encrypted_password' => $this->encryptedPassword,
|
||||
'encrypted_tag' => $this->encryptedTag,
|
||||
'updated' => $this->updated->format('Y-m-d H:i:s')
|
||||
];
|
||||
}
|
||||
|
||||
public static function fromArray(array $data): SecurePasswordRecord
|
||||
{
|
||||
return new SecurePasswordRecord($data);
|
||||
}
|
||||
}
|
|
@ -144,6 +144,26 @@
|
|||
return $this->flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a given flag exists in the list of session flags.
|
||||
*
|
||||
* @param string|SessionFlags $flag The flag to check, either as a string or a SessionFlags object.
|
||||
* @return bool True if the flag exists, false otherwise.
|
||||
*/
|
||||
public function flagExists(string|SessionFlags $flag): bool
|
||||
{
|
||||
if(is_string($flag))
|
||||
{
|
||||
$flag = SessionFlags::tryFrom($flag);
|
||||
if($flag === null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return in_array($flag, $this->flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the timestamp of the last request made.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue