chiark / gitweb /
blinding: Move another setting of Params into check_divert
[cgi-auth-flexible.git] / cgi-auth-flexible.pm
index 8f0538fbf1931ddd87447e583995034dec08a845..8eeea922f0ebd7e5b03347b2b1f44cb8f6d091c5 100644 (file)
@@ -819,7 +819,9 @@ sub _check_divert_core ($) {
        return ({ Kind => 'REDIRECT-LOGGEDOUT',
                  Message => $r->_gt("Logging out..."),
                  _CookieRaw => '',
-                 Params => { } });
+                 Params => {
+                     $r->{S}{loggedout_param_names}[0] => [ 1 ],
+                 } });
     }
     if ($r->_ch('is_loggedout')) {
        die unless $meth eq 'GET';
@@ -1033,6 +1035,11 @@ sub check_divert ($) {
 
     my $cookraw = $r->{_CookieRaw};
     $r->{CookieSecret} = $$cookraw;
+    if ($cookraw) {
+       $r->{Params}{$r->{S}{assoc_param_name}} = [
+           $r->hash($cookraw)
+           ];
+    }
 
     $r->_debug(Data::Dumper->Dump([$r->{Divert}],[qw(divert)]));
     return $r->{Divert};
@@ -1095,7 +1102,6 @@ sub check_ok ($) {
        # for redirects, we honour stored Params and Cookie,
        # as we would for non-divert
        if ($kind eq 'REDIRECT-LOGGEDOUT') {
-           $params->{$r->{S}{loggedout_param_names}[0]} = [ 1 ];
        } elsif ($kind eq 'REDIRECT-LOGOUT') {
            $params->{$r->{S}{logout_param_names}[0]} = [ 1 ];
        } elsif ($kind =~ m/REDIRECT-(?:LOGGEDIN|HTTPS)/) {
@@ -1113,10 +1119,6 @@ sub check_ok ($) {
        return 0;
     }
 
-    if (defined $cookiesecret) {
-        $params->{$r->{S}{assoc_param_name}} = [ $r->hash($cookiesecret) ];
-    }
-
     my ($title, @body);
     if ($kind =~ m/^LOGIN-/) {
        $title = $r->_gt('Login');