]> git.wh0rd.org Git - tt-rss.git/commitdiff
better error reporting in session validation
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Sat, 6 Jul 2013 08:05:52 +0000 (12:05 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Sat, 6 Jul 2013 08:05:52 +0000 (12:05 +0400)
include/sessions.php

index 423ef0eda92ed0fd1cabb1cd722468c1d12350e4..66214afe76923af8779795222958f376854b2992 100644 (file)
                        return false;
                }
 
-               if ($_SESSION["ref_schema_version"] != session_get_schema_version(true))
+               if ($_SESSION["ref_schema_version"] != session_get_schema_version(true)) {
+                       $_SESSION["login_error_msg"] =
+                               __("Session failed to validate (schema version changed)");
                        return false;
+               }
 
-               if (sha1($_SERVER['HTTP_USER_AGENT']) != $_SESSION["user_agent"])
+               if (sha1($_SERVER['HTTP_USER_AGENT']) != $_SESSION["user_agent"]) {
+                       $_SESSION["login_error_msg"] =
+                               __("Session failed to validate (user agent changed)");
                        return false;
+               }
 
                if ($_SESSION["uid"]) {
                        $result = Db::get()->query(
 
                        // user not found
                        if (Db::get()->num_rows($result) == 0) {
+
+                               $_SESSION["login_error_msg"] =
+                                       __("Session failed to validate (user not found)");
+
                                return false;
                        } else {
                                $pwd_hash = Db::get()->fetch_result($result, 0, "pwd_hash");
 
                                if ($pwd_hash != $_SESSION["pwd_hash"]) {
+
+                                       $_SESSION["login_error_msg"] =
+                                               __("Session failed to validate (password changed)");
+
                                        return false;
                                }
                        }