mod_saslauth: Move authentication-success event to after session has been made authenticated.
authorKim Alvefur <zash@zash.se>
Sun, 12 Feb 2012 15:05:31 +0100
changeset 4504 55b61221ecb8
parent 4502 dd1eaecc11f9
child 4505 b1e10c327d66
mod_saslauth: Move authentication-success event to after session has been made authenticated.
plugins/mod_saslauth.lua
--- a/plugins/mod_saslauth.lua	Sat Feb 11 14:51:00 2012 +0000
+++ b/plugins/mod_saslauth.lua	Sun Feb 12 15:05:31 2012 +0100
@@ -51,11 +51,11 @@
 		module:fire_event("authentication-failure", { session = session, condition = ret, text = err_msg });
 		session.sasl_handler = session.sasl_handler:clean_clone();
 	elseif status == "success" then
-		module:fire_event("authentication-success", { session = session });
 		local username = nodeprep(session.sasl_handler.username);
 
 		local ok, err = sm_make_authenticated(session, session.sasl_handler.username);
 		if ok then
+			module:fire_event("authentication-success", { session = session });
 			session.sasl_handler = nil;
 			session:reset_stream();
 		else