From: Ian Jackson Date: Fri, 31 Aug 2012 19:58:40 +0000 (+0100) Subject: wip before oop X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;ds=sidebyside;h=e0b5d2156bf63b93189ce95ca70467300059c6e9;p=cgi-auth-flexible.git wip before oop --- diff --git a/cgi-auth-hybrid.pm b/cgi-auth-hybrid.pm index 9536ba7..44058fc 100644 --- a/cgi-auth-hybrid.pm +++ b/cgi-auth-hybrid.pm @@ -21,13 +21,17 @@ our %_s = ( assocdb_table => 'assocs', random_source => '/dev/urandom', associdlen => 128, # bits + param_name => 'cah_associd', + cookie_name => 'cah_associd', # make undef to disable cookie + param_get => sub { _c()->param($s_{param_name}) }, + cookie_get => sub { $_s{cookie_name} ? _c()->param($s_{cookie_name}) : '' }, ); use DBI; our $dbh; -sub setup { +sub new { my ($k,$v); while (($k,$v,@_) = @_) { die "unknown setting $k" unless %_s{$k}; @@ -75,3 +79,8 @@ sub record_login ($) { $username = $nusername; $assoc = $nassoc; } + +sub check () { + my $passocid = $_s{param_get}(); + my $cassocid = $_s{cookie_get}(); + if (