X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=cgi-auth-flexible.pm;fp=cgi-auth-flexible.pm;h=21805cffd8057a177222a6177d3dd3113d6a2bb6;hb=9f2017a5f9cf9e085e5a3e6de347e38eb442f281;hp=bdb96c6f7b3f58e761588460c175f6b2df8a0be6;hpb=af1635af0c27a27c20e95cc3cbefb55defd363cc;p=cgi-auth-flexible.git diff --git a/cgi-auth-flexible.pm b/cgi-auth-flexible.pm index bdb96c6..21805cf 100644 --- a/cgi-auth-flexible.pm +++ b/cgi-auth-flexible.pm @@ -919,6 +919,8 @@ sub _check_divert_core ($) { die unless $parmt eq 'y'; die unless $cookh eq $parmh; } + $r->_db_update_last($cooku,$parmh); + $r->{ParmT} = $parmt; $r->{AssocRaw} = $cooks; $r->{UserOK} = $cooku; @@ -1024,6 +1026,16 @@ sub _db_record_login_ok ($$$) { $h, $user, time); } +sub _db_update_last ($$) { + # revokes $h if it's valid; no-op if it's not + my ($r,$user,$h) = @_; + my $dbh = $r->{Dbh}; + $dbh->do("UPDATE $r->{S}{db_prefix}_assocs". + " SET last = ?". + " WHERE username = ? AND assochash = ?", {}, + time, $user, $h); +} + sub check_divert ($) { my ($r) = @_; if (exists $r->{Divert}) {