From 39cfeeebc208a6a6b85e1e2353171c73e77c3cd7 Mon Sep 17 00:00:00 2001 From: Florian Zeitz Date: Mon, 1 Oct 2012 21:07:20 +0200 Subject: mod_register: Fire event to allow blocking user registration --- plugins/mod_register.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'plugins/mod_register.lua') diff --git a/plugins/mod_register.lua b/plugins/mod_register.lua index dfc8c49b..b3abd394 100644 --- a/plugins/mod_register.lua +++ b/plugins/mod_register.lua @@ -223,6 +223,12 @@ module:hook("stanza/iq/jabber:iq:register:query", function(event) local host = module.host; if not username or username == "" then session.send(st.error_reply(stanza, "modify", "not-acceptable", "The requested username is invalid.")); + return true; + end + local user = { username = username , host = host, allowed = true } + module:fire_event("user-registering", user); + if not user.allowed then + session.send(st.error_reply(stanza, "modify", "not-acceptable", "The requested username is forbidden.")); elseif usermanager_user_exists(username, host) then session.send(st.error_reply(stanza, "cancel", "conflict", "The requested username already exists.")); else -- cgit v1.2.3