chiark / gitweb /
Testing: autotest: Move some code about
[cgi-auth-flexible.git] / cgi-auth-flexible.pm
index bdb96c6f7b3f58e761588460c175f6b2df8a0be6..21805cffd8057a177222a6177d3dd3113d6a2bb6 100644 (file)
@@ -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}) {