2022-07-03 23:44:11 +00:00
|
|
|
<?php
|
2023-10-06 21:11:28 +00:00
|
|
|
namespace Seria;
|
|
|
|
|
|
|
|
use Seria\Auth\ChatAuth;
|
|
|
|
use Seria\Users\UserInfo;
|
|
|
|
|
2022-07-03 23:44:11 +00:00
|
|
|
require_once __DIR__ . '/../seria.php';
|
|
|
|
|
2023-10-06 21:11:28 +00:00
|
|
|
$authToken = (string)filter_input(INPUT_COOKIE, 'msz_auth');
|
2023-12-15 02:04:53 +00:00
|
|
|
$authInfo = ChatAuth::attempt($cfg->scopeTo('cauth'), $authToken);
|
2023-10-06 21:11:28 +00:00
|
|
|
|
|
|
|
if($authInfo->success) {
|
|
|
|
$users = $seria->getUsersContext()->getUsers();
|
|
|
|
$users->syncChatUser($authInfo);
|
|
|
|
$sUserInfo = $users->getUser($authInfo->user_id, 'id');
|
|
|
|
$seria->getAuthInfo()->setInfo($sUserInfo);
|
|
|
|
} else $sUserInfo = null;
|
2022-07-03 23:44:11 +00:00
|
|
|
|
2023-10-06 21:11:28 +00:00
|
|
|
$seria->startCSRFP(
|
2023-12-15 02:04:53 +00:00
|
|
|
$cfg->getString('csrfp:secret', 'mewow'),
|
2023-10-06 21:11:28 +00:00
|
|
|
$authInfo->success ? $authToken : (string)filter_input(INPUT_SERVER, 'REMOTE_ADDR')
|
|
|
|
);
|
2022-07-03 23:44:11 +00:00
|
|
|
|
2023-10-06 21:11:28 +00:00
|
|
|
$seria->startTemplating();
|
|
|
|
$seria->createRouting()->dispatch();
|