Software /
code /
prosody-modules
File
mod_log_auth/mod_log_auth.lua @ 2159:5e8dec076afc
mod_auth_http_async: Fall back to non-async calling of http_auth_url
if util.async is not available
author | JC Brand <jcbrand@minddistrict.com> |
---|---|
date | Fri, 15 Apr 2016 13:45:01 +0000 |
parent | 2084:9d43095d915f |
child | 2695:8b21f13b08c5 |
line wrap: on
line source
local mode = module:get_option_string("log_auth_ips", "failure"); assert(({ all = true, failure = true, success = true })[mode], "Unknown log mode: "..tostring(mode).." - valid modes are 'all', 'failure', 'success'"); if mode == "failure" or mode == "all" then module:hook("authentication-failure", function (event) module:log("info", "Failed authentication attempt (%s) for user %s from IP: %s", event.condition or "unknown-condition", event.session.username or "?", event.session.ip or "?"); end); end if mode == "success" or mode == "all" then module:hook("authentication-success", function (event) local session = event.session; module:log("info", "Successful authentication as %s from IP: %s", session.username, session.ip or "?"); end); end