aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Zeitz <florob@babelmonkeys.de>2012-10-01 21:07:20 +0200
committerFlorian Zeitz <florob@babelmonkeys.de>2012-10-01 21:07:20 +0200
commit429871c36f88477a37dc312bb65d79b49e0121f4 (patch)
treeab1b1beb73f5375a5e05b02e7aed01cdb3cf512c
parent8279c2cf005b4ada8baf324d36a8ff90f80ca4e0 (diff)
downloadprosody-429871c36f88477a37dc312bb65d79b49e0121f4.tar.gz
prosody-429871c36f88477a37dc312bb65d79b49e0121f4.zip
mod_register: Fire event to allow blocking user registration
-rw-r--r--plugins/mod_register.lua6
1 files changed, 6 insertions, 0 deletions
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