mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 10:45:56 +00:00
move logout_user() to UserHelper
This commit is contained in:
@@ -81,7 +81,7 @@ class API extends Handler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function logout() {
|
function logout() {
|
||||||
Pref_Users::logout_user();
|
UserHelper::logout();
|
||||||
$this->wrap(self::STATUS_OK, array("status" => "OK"));
|
$this->wrap(self::STATUS_OK, array("status" => "OK"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -286,7 +286,7 @@ class Handler_Public extends Handler {
|
|||||||
|
|
||||||
function logout() {
|
function logout() {
|
||||||
if (validate_csrf($_POST["csrf_token"])) {
|
if (validate_csrf($_POST["csrf_token"])) {
|
||||||
Pref_Users::logout_user();
|
UserHelper::logout();
|
||||||
header("Location: index.php");
|
header("Location: index.php");
|
||||||
} else {
|
} else {
|
||||||
header("Content-Type: text/json");
|
header("Content-Type: text/json");
|
||||||
|
|||||||
@@ -418,15 +418,4 @@ class Pref_Users extends Handler_Protected {
|
|||||||
return $default;
|
return $default;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function logout_user() {
|
|
||||||
if (session_status() === PHP_SESSION_ACTIVE)
|
|
||||||
session_destroy();
|
|
||||||
|
|
||||||
if (isset($_COOKIE[session_name()])) {
|
|
||||||
setcookie(session_name(), '', time()-42000, '/');
|
|
||||||
|
|
||||||
}
|
|
||||||
session_commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ class UserHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($_SESSION["uid"])) {
|
if (empty($_SESSION["uid"])) {
|
||||||
Pref_Users::logout_user();
|
UserHelper::logout();
|
||||||
|
|
||||||
Handler_Public::render_login_form();
|
Handler_Public::render_login_form();
|
||||||
exit;
|
exit;
|
||||||
@@ -157,4 +157,16 @@ class UserHelper {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static function logout() {
|
||||||
|
if (session_status() === PHP_SESSION_ACTIVE)
|
||||||
|
session_destroy();
|
||||||
|
|
||||||
|
if (isset($_COOKIE[session_name()])) {
|
||||||
|
setcookie(session_name(), '', time()-42000, '/');
|
||||||
|
|
||||||
|
}
|
||||||
|
session_commit();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user