From e0b5d2156bf63b93189ce95ca70467300059c6e9 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 31 Aug 2012 20:58:40 +0100 Subject: [PATCH 1/1] wip before oop --- cgi-auth-hybrid.pm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 ( -- 2.30.2