view mod_lastlog/mod_lastlog.lua @ 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
children 884ae37d76bf
line wrap: on
line source

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);