misuzu/public/auth/logout.php

25 lines
578 B
PHP
Raw Normal View History

2019-03-08 00:35:53 +00:00
<?php
namespace Misuzu;
2020-05-25 19:58:06 +00:00
use Misuzu\Users\User;
use Misuzu\Users\UserSession;
2019-03-08 00:35:53 +00:00
require_once '../../misuzu.php';
2020-05-25 19:58:06 +00:00
if(!UserSession::hasCurrent()) {
url_redirect('index');
2019-03-08 00:35:53 +00:00
return;
}
2019-12-11 18:10:54 +00:00
if(CSRF::validateRequest()) {
setcookie('msz_auth', '', -9001, '/', '.' . $_SERVER['HTTP_HOST'], !empty($_SERVER['HTTPS']), true);
2019-08-14 19:44:30 +00:00
setcookie('msz_auth', '', -9001, '/', '', !empty($_SERVER['HTTPS']), true);
2020-05-25 19:58:06 +00:00
UserSession::getCurrent()->delete();
UserSession::unsetCurrent();
User::unsetCurrent();
url_redirect('index');
2019-03-08 00:35:53 +00:00
return;
}
Template::render('auth.logout');