Changeset

615:4134d0e25242

mod_lastlog: New module to record last time a user authenticated
author Kim Alvefur <zash@zash.se>
date Fri, 24 Feb 2012 15:28:17 +0100
parents 614:40ab83736f6e
children 616:884ae37d76bf
files mod_lastlog/mod_lastlog.lua
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mod_lastlog/mod_lastlog.lua	Fri Feb 24 15:28:17 2012 +0100
@@ -0,0 +1,11 @@
+local datamanager = require "util.datamanager";	
+local time = os.time;
+
+module:hook("authentication-success", function(event)
+	local session = event.session;
+	if session.username then
+		datamanager.store(session.username, session.host, "lastlog", {
+			timestamp = time(),
+		});
+	end
+end);