1
0
Fork 0
mirror of synced 2024-07-01 04:30:59 +12:00

fix: merge conflicts

This commit is contained in:
Torsten Dittmann 2024-01-18 13:43:49 +01:00
parent 1ab3dc2236
commit d802e86593

View file

@ -1242,6 +1242,13 @@ $createSession = function (string $userId, string $secret, Request $request, Res
$sessionSecret = Auth::tokenGenerator(Auth::TOKEN_LENGTH_SESSION);
$expire = DateTime::formatTz(DateTime::addSeconds(new \DateTime(), $duration));
$factor = match($verifiedToken->getAttribute('type')) {
Auth::TOKEN_TYPE_MAGIC_URL, Auth::TOKEN_TYPE_OAUTH2 => 'email',
Auth::TOKEN_TYPE_PHONE => 'phone',
Auth::TOKEN_TYPE_GENERIC => 'token',
default => throw new Exception(Exception::USER_INVALID_TOKEN)
};
$session = new Document(array_merge(
[
'$id' => ID::unique(),
@ -1251,6 +1258,7 @@ $createSession = function (string $userId, string $secret, Request $request, Res
'secret' => Auth::hash($sessionSecret), // One way hash encryption to protect DB leak
'userAgent' => $request->getUserAgent('UNKNOWN'),
'ip' => $request->getIP(),
'factors' => [$factor],
'countryCode' => ($record) ? \strtolower($record['country']['iso_code']) : '--',
],
$detector->getOS(),