]> git.wh0rd.org - tt-rss.git/commitdiff
login: check for stale session in login handler, instead of authenticate_user()
authorAndrew Dolgov <noreply@fakecake.org>
Tue, 16 Oct 2018 08:39:12 +0000 (11:39 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Tue, 16 Oct 2018 08:39:12 +0000 (11:39 +0300)
classes/handler/public.php
include/functions.php

index de9c9684a00336db2b37d1b8d4ddf967e8f01c5f..38a8d749b91179f8e0b4a6cb49e33cb87ad9a4c2 100755 (executable)
@@ -465,6 +465,14 @@ class Handler_Public extends Handler {
 
        function login() {
                if (!SINGLE_USER_MODE) {
+                       /* if a session is started here there's a stale login cookie we need to clean */
+
+                       if (session_status() != PHP_SESSION_NONE) {
+                               $_SESSION["login_error_msg"] = __("Stale session cookie found, try logging in again");
+
+                               header("Location: " . get_self_url_prefix());
+                               exit;
+                       }
 
                        $login = clean($_POST["login"]);
                        $password = clean($_POST["password"]);
index 5588590a85c2ab8a99268af9db4d20fef498d308..006d17a4887c3683920bd73b2d5bdbaddd8345ef 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["login_error_msg"] = __("Stale session cookie found, try logging in again");
-                                       return false;
-                               }
-
                                session_regenerate_id(true);
                                session_start();