misuzu/public-legacy/auth/logout.php

22 lines
388 B
PHP
Raw Permalink Normal View History

2022-09-13 13:14:49 +00:00
<?php
namespace Misuzu;
use Misuzu\Users\User;
use Misuzu\Users\UserSession;
if(!UserSession::hasCurrent()) {
url_redirect('index');
return;
}
if(CSRF::validateRequest()) {
2023-05-21 18:15:04 +00:00
AuthToken::nukeCookie();
2022-09-13 13:14:49 +00:00
UserSession::getCurrent()->delete();
UserSession::unsetCurrent();
User::unsetCurrent();
url_redirect('index');
return;
}
Template::render('auth.logout');