[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Invalidate active sessions after password change

"Elifeleti Mukisa Dan \(@Danelif\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <698314e4bb2b_3b18448033492@gitlab-sidekiq-low-urgency-cpu-bound-v2-65d8676567-6c7vh.mail>

Elifeleti Mukisa Dan pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
7ca463d7 by Elifeleti Mukisa Dan at 2026-02-04T09:35:22+00:00
[FIX] Invalidate active sessions after password change
---
* [FIX] Invalidate active sessions after password change


(cherry picked from commit 62e036368b65d3c1e71f913576e5ead2e19966d4)

b5d525fd [FIX] Invalidate active sessions after password change
52c8049d Redirect to login page after session invalidation
db0ea077 Avoid HTTP redirect when invalidating session in CLI mode

Co-authored-by: Yves Ngalamulume <[email protected]>

See merge request tikiwiki/tiki!9486

- - - - -


3 changed files:

- tiki-login.php
- tiki-setup.php
- tiki-user_preferences.php


Changes:

=====================================
tiki-login.php
=====================================
@@ -413,6 +413,7 @@ if ($isvalid && ($isOpenIdValid || $access->checkCsrf(null, null, null, null, nu
         TikiLib::lib('login')->activateSession($user);
 
         $url = $_SESSION['loginfrom'];
+        $_SESSION['login_time'] = time();
 
         // When logging into a multi-lingual Tiki, $_SESSION['loginfrom'] contains the main-language page, and not the translated one
         //  This only applies if feature_best_language and only seems to affect SEFURL


=====================================
tiki-setup.php
=====================================
@@ -68,6 +68,18 @@ $tiki_timer->start();
 
 require_once('tiki-setup_base.php'); //Starting here composer autoloading is available
 
+if (! empty($user) && isset($_SESSION['login_time'])) {
+    $userInfo = $userlib->get_user_info($user);
+
+    if (! empty($userInfo['lastLogin']) && $_SESSION['login_time'] < $userInfo['lastLogin']) {
+        TikiLib::lib('login')->logout();
+        if (! defined('TIKI_CONSOLE') && PHP_SAPI !== 'cli') {
+            header('Location:tiki-login_scr.php');
+        }
+        exit;
+    }
+}
+
 if (version_compare(PHP_VERSION, TIKI_MIN_PHP_VERSION, '<')) {
     if (PHP_SAPI !== 'cli') {                   // if not running a command line version of php, show requirements
         header('location: tiki-install.php');


=====================================
tiki-user_preferences.php
=====================================
@@ -477,6 +477,7 @@ if (isset($_POST['chgadmin']) && $access->checkCsrf()) {
             Feedback::errorAndDie($polerr, \Laminas\Http\Response::STATUS_CODE_400);
         }
         $userlib->change_user_password($userwatch, $_POST["pass1"]);
+        $userlib->update_lastlogin($userwatch);
         if ($prefs['feature_user_encryption'] === 'y') {
             // Notify CryptLib about the login
             $cryptlib = TikiLib::lib('crypt');



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/7ca463d750ca8f19a27b112209ec7881dc6988f9

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/7ca463d750ca8f19a27b112209ec7881dc6988f9
You're receiving this email because of your account on gitlab.com.

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.