# HG changeset patch # User Kim Alvefur # Date 1330093697 -3600 # Node ID 4134d0e2524251ffd43876b2bd2d39a1a2073dac # Parent 40ab83736f6e8a2a44a7ad223e4068dd76255601 mod_lastlog: New module to record last time a user authenticated diff -r 40ab83736f6e -r 4134d0e25242 mod_lastlog/mod_lastlog.lua --- /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);