This commit is contained in:
the-djmaze 2023-10-02 16:15:29 +02:00
parent 26b7abf893
commit edad4ac025
4 changed files with 11 additions and 10 deletions

View file

@ -294,9 +294,6 @@ trait UserAuth
{
$this->oAdditionalAuthAccount = false;
$this->oMainAuthAccount = $oAccount;
if (!isset($_COOKIE['smctoken'])) {
Cookies::set('smctoken', \base64_encode(\random_bytes(16)), 0, false);
}
static::SetAccountCookie(self::AUTH_SPEC_TOKEN_KEY, $oAccount);
}

View file

@ -41,13 +41,14 @@ abstract class Crypt
}
/**
* When $key is empty, it will use a fingerprint of the user agent.
* When $key is empty, it will use the smctoken.
*/
private static function Passphrase(?string $key) : string
{
if (!$key) {
if (empty($_COOKIE['smctoken'])) {
throw new \RuntimeException('Missing smctoken');
\SnappyMail\Cookies::set('smctoken', \base64_encode(\random_bytes(16)), 0, false);
// throw new \RuntimeException('Missing smctoken');
}
$key = $_COOKIE['smctoken'] . APP_VERSION;
}