]> git.wh0rd.org Git - tt-rss.git/commitdiff
another attempt to enforce session ID regeneration on login
authorAndrew Dolgov <noreply@fakecake.org>
Tue, 16 Oct 2018 06:11:32 +0000 (09:11 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Tue, 16 Oct 2018 06:11:32 +0000 (09:11 +0300)
classes/handler/public.php
include/functions.php

index 7cce7d71b061d24f5bf1f93093b9b5173456e354..de9c9684a00336db2b37d1b8d4ddf967e8f01c5f 100755 (executable)
@@ -503,7 +503,9 @@ class Handler_Public extends Handler {
                                // start an empty session to deliver login error message
                                @session_start();
 
-                               $_SESSION["login_error_msg"] = __("Incorrect username or password");
+                               if (!isset($_SESSION["login_error_msg"]))
+                                       $_SESSION["login_error_msg"] = __("Incorrect username or password");
+
                                user_error("Failed login attempt for $login from {$_SERVER['REMOTE_ADDR']}", E_USER_WARNING);
                        }
 
index a04a393ec3382c4fd852080e756f3cbc3e2d5e61..5588590a85c2ab8a99268af9db4d20fef498d308 100755 (executable)
 
                        if ($user_id && !$check_only) {
 
+                               /* if a session is started here there's a stale login cookie we need to clean */
+
                                if (session_status() != PHP_SESSION_NONE) {
-                                       session_destroy();
-                                       session_commit();
+                                       $_SESSION["login_error_msg"] = __("Stale session cookie found, try logging in again");
+                                       return false;
                                }
 
                                session_regenerate_id(true);