]> bicyclesonthemoon.info Git - ott/bsta/blobdiff - viewer.1.pl
include password in empty goto redirect
[ott/bsta] / viewer.1.pl
index 338eb875d46bcc8420214b172167d35b870ef9df..97f0434f55654af3825261e485d3465bac820d6b 100644 (file)
@@ -123,15 +123,6 @@ if ($method eq 'POST') {
        }
 }
 
-if (
-       (defined $cgi{'f'}) &&
-       ($cgi{'f'} eq '') &&
-       ($cgi{'g'} ne '')
-) { # GOTO with no value
-       exit redirect($method, CGI_GOTO_PATH(), HTTP_STATUS->{'see_other'});
-}
-
-
 $no_cgi = (scalar (keys %cgi) == 0);
 
 $IP = get_remote_addr();
@@ -147,6 +138,22 @@ if ($frame >= 0) {
 
 $password_ok = ($password eq $settings{'password'});
 
+if (
+       (defined $cgi{'f'}) &&
+       ($cgi{'f'} eq '') &&
+       ($cgi{'g'} ne '')
+) { # GOTO with no value
+       my $goto_url = CGI_GOTO_PATH();
+       if ($password_ok) {
+               $goto_url = merge_url(
+                       {'path' => $goto_url},
+                       {'query' => {'p' => $password}}
+               );
+       }
+       exit redirect($method, $goto_url, HTTP_STATUS->{'see_other'});
+}
+
+
 # state & activation logic
 if (open_encoded($fh, "+<:encoding(UTF-8)", DATA_STATE_PATH())) {
        if (flock($fh, 2)) {