diff options
author | Simon Rettberg | 2023-01-05 15:06:48 +0100 |
---|---|---|
committer | Simon Rettberg | 2023-01-05 15:06:48 +0100 |
commit | 2b40b23f14f2e23b8bb1a2b09f188d9eceea2d27 (patch) | |
tree | db7d6748a70ea559da9a6d6f44df781ecb971f69 /inc | |
parent | [main] Remove "Change Password" in menu; make username a link instead (diff) | |
download | slx-admin-2b40b23f14f2e23b8bb1a2b09f188d9eceea2d27.tar.gz slx-admin-2b40b23f14f2e23b8bb1a2b09f188d9eceea2d27.tar.xz slx-admin-2b40b23f14f2e23b8bb1a2b09f188d9eceea2d27.zip |
[session] Add checkbox to log out all other sessions on pw change
Diffstat (limited to 'inc')
-rw-r--r-- | inc/session.inc.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/inc/session.inc.php b/inc/session.inc.php index d83de088..f2cb1848 100644 --- a/inc/session.inc.php +++ b/inc/session.inc.php @@ -107,6 +107,19 @@ class Session self::$data = false; } + /** + * Kill all sessions of currently logged-in user. This can be used as + * a security measure if the user suspects that a session left open on + * another device could be/is being abused. + */ + public static function deleteAllButCurrent() + { + if (self::$sid === false) + return; + Database::exec("DELETE FROM session WHERE sid <> :sid AND userid = :uid", + ['sid' => self::$sid, 'uid' => self::$userId]); + } + public static function deleteCookie() { Util::clearCookie('sid'); |