2022-09-13 13:14:49 +00:00
|
|
|
<?php
|
|
|
|
namespace Misuzu;
|
|
|
|
|
2023-08-03 01:35:08 +00:00
|
|
|
use Misuzu\Auth\AuthTokenCookie;
|
|
|
|
|
|
|
|
if($msz->isLoggedIn()) {
|
|
|
|
if(!CSRF::validateRequest()) {
|
|
|
|
Template::render('auth.logout');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$tokenInfo = $msz->getAuthInfo()->getTokenInfo();
|
|
|
|
|
|
|
|
$msz->getSessions()->deleteSessions(sessionTokens: $tokenInfo->getSessionToken());
|
|
|
|
|
|
|
|
$tokenBuilder = $tokenInfo->toBuilder();
|
|
|
|
$tokenBuilder->removeUserId();
|
|
|
|
$tokenBuilder->removeSessionToken();
|
|
|
|
$tokenBuilder->removeImpersonatedUserId();
|
|
|
|
$tokenInfo = $tokenBuilder->toInfo();
|
2022-09-13 13:14:49 +00:00
|
|
|
|
2023-08-03 01:35:08 +00:00
|
|
|
AuthTokenCookie::apply($tokenPacker->pack($tokenInfo));
|
2022-09-13 13:14:49 +00:00
|
|
|
}
|
|
|
|
|
2023-08-03 01:35:08 +00:00
|
|
|
url_redirect('index');
|