Software /
code /
prosody
Changeset
5165:39bb9344f194
mod_register: Fire event to allow blocking user registration
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Mon, 01 Oct 2012 21:07:20 +0200 |
parents | 5163:854f6d9aee2d |
children | 5166:72cdc2d4e15e 5167:ecd9e300ec94 |
files | plugins/mod_register.lua |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_register.lua Sat Sep 29 17:07:08 2012 +0100 +++ b/plugins/mod_register.lua Mon Oct 01 21:07:20 2012 +0200 @@ -223,6 +223,12 @@ 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