seria/public/index.php

25 lines
717 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($cfg->scopeTo('cauth'), $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(
$cfg->getString('csrfp:secret', 'mewow'),
$authInfo->success ? $authToken : (string)filter_input(INPUT_SERVER, 'REMOTE_ADDR')
);
$seria->startTemplating();
$seria->createRouting()->dispatch();