Made message signing in Cryptography use SHA512 as the message content for... #1
2 changed files with 24 additions and 4 deletions
|
@ -436,14 +436,21 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't do anything if the flags to remove are not present
|
||||||
|
if(!$session->flagExists($flagsToRemove))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove & update the session flags
|
||||||
self::removeFlags($session->getUuid(), $flagsToRemove);
|
self::removeFlags($session->getUuid(), $flagsToRemove);
|
||||||
$session = self::getSession($session->getUuid());
|
$session = self::getSession($session->getUuid());
|
||||||
|
|
||||||
// Check if all registration/authentication requirements are met
|
// Check if all registration/authentication requirements are met
|
||||||
if(SessionFlags::isComplete($session->getFlags()))
|
if(SessionFlags::isComplete($session->getFlags()))
|
||||||
{
|
{
|
||||||
SessionManager::setAuthenticated($session->getUuid(), true);
|
SessionManager::removeFlags($session->getUuid(), [SessionFlags::REGISTRATION_REQUIRED, SessionFlags::AUTHENTICATION_REQUIRED]); // Remove the registration/authentication flags
|
||||||
SessionManager::removeFlags($session->getUuid(), [SessionFlags::REGISTRATION_REQUIRED, SessionFlags::AUTHENTICATION_REQUIRED]);
|
SessionManager::setAuthenticated($session->getUuid(), true); // Mark the session as authenticated
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -213,11 +213,24 @@
|
||||||
/**
|
/**
|
||||||
* Checks if a given flag exists in the list of session 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.
|
* @param string|SessionFlags|array $flag The flag to check, either as a string or a SessionFlags object. If an array is provided, all flags must exist.
|
||||||
* @return bool True if the flag exists, false otherwise.
|
* @return bool True if the flag exists, false otherwise.
|
||||||
*/
|
*/
|
||||||
public function flagExists(string|SessionFlags $flag): bool
|
public function flagExists(string|SessionFlags|array $flag): bool
|
||||||
{
|
{
|
||||||
|
if(is_array($flag))
|
||||||
|
{
|
||||||
|
foreach($flag as $f)
|
||||||
|
{
|
||||||
|
if(!$this->flagExists($f))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if(is_string($flag))
|
if(is_string($flag))
|
||||||
{
|
{
|
||||||
$flag = SessionFlags::tryFrom($flag);
|
$flag = SessionFlags::tryFrom($flag);
|
||||||
|
|
Loading…
Add table
Reference in a new issue