Merged OAuth2 handling into Misuzu.

This commit is contained in:
flash 2025-02-02 02:09:56 +00:00
parent 1994a9892d
commit 534e947522
115 changed files with 4556 additions and 77 deletions

View file

@ -7,7 +7,7 @@ use Misuzu\Auth\AuthTokenCookie;
if(!isset($msz) || !($msz instanceof \Misuzu\MisuzuContext))
die('Script must be called through the Misuzu route dispatcher.');
if($msz->authInfo->isLoggedIn) {
if($msz->authInfo->loggedIn) {
Tools::redirect($msz->urls->format('index'));
return;
}

View file

@ -6,7 +6,7 @@ use Misuzu\Auth\AuthTokenCookie;
if(!isset($msz) || !($msz instanceof \Misuzu\MisuzuContext))
die('Script must be called through the Misuzu route dispatcher.');
if($msz->authInfo->isLoggedIn) {
if($msz->authInfo->loggedIn) {
if(!CSRF::validateRequest()) {
Template::render('auth.logout');
return;

View file

@ -7,7 +7,7 @@ use Misuzu\Users\User;
if(!isset($msz) || !($msz instanceof \Misuzu\MisuzuContext))
die('Script must be called through the Misuzu route dispatcher.');
if($msz->authInfo->isLoggedIn) {
if($msz->authInfo->loggedIn) {
Tools::redirect($msz->urls->format('settings-account'));
return;
}

View file

@ -7,7 +7,7 @@ use Misuzu\Users\User;
if(!isset($msz) || !($msz instanceof \Misuzu\MisuzuContext))
die('Script must be called through the Misuzu route dispatcher.');
if($msz->authInfo->isLoggedIn) {
if($msz->authInfo->loggedIn) {
Tools::redirect($msz->urls->format('index'));
return;
}

View file

@ -8,7 +8,7 @@ use Misuzu\Auth\AuthTokenCookie;
if(!isset($msz) || !($msz instanceof \Misuzu\MisuzuContext))
die('Script must be called through the Misuzu route dispatcher.');
if($msz->authInfo->isLoggedIn) {
if($msz->authInfo->loggedIn) {
Tools::redirect($msz->urls->format('index'));
return;
}

View file

@ -15,7 +15,7 @@ if(!Tools::isLocalURL($redirect))
if(!CSRF::validateRequest())
Template::displayInfo("Couldn't verify this request, please refresh the page and try again.", 403);
if(!$msz->authInfo->isLoggedIn)
if(!$msz->authInfo->loggedIn)
Template::displayInfo('You must be logged in to manage comments.', 403);
if($msz->usersCtx->hasActiveBan($msz->authInfo->userInfo))

View file

@ -11,7 +11,7 @@ use Carbon\CarbonImmutable;
if(!isset($msz) || !($msz instanceof \Misuzu\MisuzuContext))
die('Script must be called through the Misuzu route dispatcher.');
if(!$msz->authInfo->isLoggedIn)
if(!$msz->authInfo->loggedIn)
Template::throwError(401);
$currentUser = $msz->authInfo->userInfo;

View file

@ -11,7 +11,7 @@ if(!isset($msz) || !($msz instanceof \Misuzu\MisuzuContext))
die('Script must be called through the Misuzu route dispatcher.');
$viewerPerms = $msz->authInfo->getPerms('user');
if(!$msz->authInfo->isLoggedIn)
if(!$msz->authInfo->loggedIn)
Template::throwError(403);
$currentUser = $msz->authInfo->userInfo;

View file

@ -6,7 +6,7 @@ use RuntimeException;
if(!isset($msz) || !($msz instanceof \Misuzu\MisuzuContext))
die('Script must be called through the Misuzu route dispatcher.');
if(!$msz->authInfo->isLoggedIn)
if(!$msz->authInfo->loggedIn)
Template::throwError(403);
// TODO: restore forum-topics and forum-posts orderings

View file

@ -9,7 +9,7 @@ use Misuzu\Comments\CommentsCategory;
if(!isset($msz) || !($msz instanceof \Misuzu\MisuzuContext))
die('Script must be called through the Misuzu route dispatcher.');
if(!$msz->authInfo->isLoggedIn)
if(!$msz->authInfo->loggedIn)
Template::throwError(403);
$searchQuery = !empty($_GET['q']) && is_string($_GET['q']) ? $_GET['q'] : '';

View file

@ -9,7 +9,7 @@ use chillerlan\QRCode\QROptions;
if(!isset($msz) || !($msz instanceof \Misuzu\MisuzuContext))
die('Script must be called through the Misuzu route dispatcher.');
if(!$msz->authInfo->isLoggedIn)
if(!$msz->authInfo->loggedIn)
Template::throwError(401);
$errors = [];

View file

@ -8,7 +8,7 @@ use Misuzu\Users\UserInfo;
if(!isset($msz) || !($msz instanceof \Misuzu\MisuzuContext))
die('Script must be called through the Misuzu route dispatcher.');
if(!$msz->authInfo->isLoggedIn)
if(!$msz->authInfo->loggedIn)
Template::throwError(401);
$dbConn = $msz->dbConn;

View file

@ -6,7 +6,7 @@ use RuntimeException;
if(!isset($msz) || !($msz instanceof \Misuzu\MisuzuContext))
die('Script must be called through the Misuzu route dispatcher.');
if(!$msz->authInfo->isLoggedIn)
if(!$msz->authInfo->loggedIn)
Template::throwError(401);
$errors = [];