From: Ian Jackson Date: Fri, 31 Aug 2012 20:15:01 +0000 (+0100) Subject: wip before timeout X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=cgi-auth-flexible.git;a=commitdiff_plain;h=5ada8633da1b049cc7339b065abe55462e7e1ab1;ds=sidebyside wip before timeout --- diff --git a/cgi-auth-hybrid.pm b/cgi-auth-hybrid.pm index c5a6b37..a563042 100644 --- a/cgi-auth-hybrid.pm +++ b/cgi-auth-hybrid.pm @@ -29,8 +29,11 @@ sub new { param_name => 'cah_associd', cookie_name => 'cah_associd', # make undef to disable cookie cgi => undef, - param_get => sub { $s->_c()->param($s->{S}{param_name}) }, - cookie_get => sub { $s->_c()->cookie($s->{S}{cookie_name}) : '' }, + get_param => sub { $s->_c()->param($s->{S}{param_name}) }, + get_cookie => sub { $s->{S}{cookie_name} + ? $s->_c()->cookie($s->{S}{cookie_name}) + : '' }, + get_method => sub { $s->_c()->request_method() }, }, D => undef, }; @@ -94,6 +97,10 @@ sub record_login ($$) { } sub check () { - my $passocid = $s->{S}{param_get}(); - my $cassocid = $s->{S}{cookie_get}(); - if ( + my $qassocid = $s->{S}{param_get}(); + if (!defined $qassocid) { + $qassocid = $s->{S}{cookie_get}(); + return 0 unless defined $qassocid; + return 0 unless $s->{S}{get_method}() eq 'GET'; + } +