Logs last use of Auth-Groupe-X keys (Closes #1476).
authorStéphane Jacob <sj@m4x.org>
Mon, 25 Apr 2011 22:12:20 +0000 (00:12 +0200)
committerStéphane Jacob <sj@m4x.org>
Mon, 25 Apr 2011 22:12:20 +0000 (00:12 +0200)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
ChangeLog
modules/auth.php
upgrade/1.1.1/09_auth_groupex.sql [new file with mode: 0644]

index 11a354e..045ad1d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@ Bug/Wish:
 
     * Auth:
         - #1474: Provides accounts data for accounts without profile       -JAC
+        - #1476: Logs last use of Auth-Groupe-X keys                       -JAC
 
     * Emails:
         - #1110: Improves email combobox                                   -JAC
index 1883ab6..88a1e9d 100644 (file)
@@ -145,6 +145,10 @@ class AuthModule extends PLModule
                 // the user to the real GroupeX website, which defeats the attack).
                 if (empty($returnurls) || @preg_match($returnurls, $gpex_url)) {
                     $returl = $gpex_url . gpex_make_params($gpex_challenge, $privkey, $datafields, $charset);
+                    XDB::execute('UPDATE  group_auth
+                                     SET  last_used = DATE(NOW())
+                                   WHERE  name = {?}',
+                                 $name);
                     http_redirect($returl);
                 } else if (S::admin()) {
                     $page->kill("La requête d'authentification a échouée (url de retour invalide).");
@@ -166,6 +170,7 @@ class AuthModule extends PLModule
         $table_editor->describe('privkey','clé privée',false);
         $table_editor->describe('datafields','champs renvoyés',true);
         $table_editor->describe('returnurls','urls de retour',true);
+        $table_editor->describe('last_used', 'dernière utilisation', true);
         $table_editor->apply($page, $action, $id);
     }
 }
diff --git a/upgrade/1.1.1/09_auth_groupex.sql b/upgrade/1.1.1/09_auth_groupex.sql
new file mode 100644 (file)
index 0000000..93ff9c4
--- /dev/null
@@ -0,0 +1,3 @@
+ALTER TABLE group_auth ADD COLUMN last_used DATE DEFAULT NULL;
+
+-- vim:set syntax=mysql: