25 lines
711 B
PHP
25 lines
711 B
PHP
<?php
|
|
namespace Seria;
|
|
|
|
use Seria\Auth\ChatAuth;
|
|
use Seria\Users\UserInfo;
|
|
|
|
require_once __DIR__ . '/../seria.php';
|
|
|
|
$authToken = (string)filter_input(INPUT_COOKIE, 'msz_auth');
|
|
$authInfo = ChatAuth::attempt(SERIA_CAUTH_ENDPOINT, SERIA_MSZ_SECRET, $authToken);
|
|
|
|
if($authInfo->success) {
|
|
$users = $seria->getUsersContext()->getUsers();
|
|
$users->syncChatUser($authInfo);
|
|
$sUserInfo = $users->getUser($authInfo->user_id, 'id');
|
|
$seria->getAuthInfo()->setInfo($sUserInfo);
|
|
} else $sUserInfo = null;
|
|
|
|
$seria->startCSRFP(
|
|
SERIA_CSRFP_SECRET,
|
|
$authInfo->success ? $authToken : (string)filter_input(INPUT_SERVER, 'REMOTE_ADDR')
|
|
);
|
|
|
|
$seria->startTemplating();
|
|
$seria->createRouting()->dispatch();
|