]> git.wh0rd.org - tt-rss.git/blobdiff - classes/handler/public.php
force regenerate session id on successful login, remove previous blank SID check
[tt-rss.git] / classes / handler / public.php
old mode 100644 (file)
new mode 100755 (executable)
index 8440bc3..7cce7d7
@@ -476,8 +476,6 @@ class Handler_Public extends Handler {
                                session_set_cookie_params(0);
                        }
 
-                       @session_start();
-
                        if (authenticate_user($login, $password)) {
                                $_POST["password"] = "";
 
@@ -501,6 +499,10 @@ class Handler_Public extends Handler {
                                        }
                                }
                        } else {
+
+                               // start an empty session to deliver login error message
+                               @session_start();
+
                                $_SESSION["login_error_msg"] = __("Incorrect username or password");
                                user_error("Failed login attempt for $login from {$_SERVER['REMOTE_ADDR']}", E_USER_WARNING);
                        }
@@ -934,17 +936,17 @@ class Handler_Public extends Handler {
        }
 
        function cached_url() {
-               @$hash = basename($_GET['hash']);
+               @$req_filename = basename($_GET['hash']);
 
                // we don't need an extension to find the file, hash is a complete URL
-               $hash = preg_replace("/\.[^\.]*$/", "", $hash);
+               $hash = preg_replace("/\.[^\.]*$/", "", $req_filename);
 
                if ($hash) {
 
                        $filename = CACHE_DIR . '/images/' . $hash;
 
                        if (file_exists($filename)) {
-                               header("Content-Disposition: inline; filename=\"$hash\"");
+                               header("Content-Disposition: inline; filename=\"$req_filename\"");
 
                                send_local_file($filename);