Mercurial > prosody-modules
comparison mod_register_web/mod_register_web.lua @ 2922:9f60905406ba
mod_register_web: Include IP address in pre-registration check event to allow other modules a chance to act on it
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 10 Mar 2018 02:38:42 +0100 |
parents | 57d4680b86a4 |
children | 9d53134a0b29 |
comparison
equal
deleted
inserted
replaced
2921:3264058ae54f | 2922:9f60905406ba |
---|---|
122 return nil, "The username field was empty"; | 122 return nil, "The username field was empty"; |
123 end | 123 end |
124 if usermanager.user_exists(prepped_username, module.host) then | 124 if usermanager.user_exists(prepped_username, module.host) then |
125 return nil, "Username already taken"; | 125 return nil, "Username already taken"; |
126 end | 126 end |
127 local registering = { username = prepped_username , host = module.host, allowed = true } | 127 local registering = { username = prepped_username , host = module.host, ip = origin.conn:ip(), allowed = true } |
128 module:fire_event("user-registering", registering); | 128 module:fire_event("user-registering", registering); |
129 if not registering.allowed then | 129 if not registering.allowed then |
130 return nil, "Registration not allowed"; | 130 return nil, "Registration not allowed"; |
131 end | 131 end |
132 if form.confirm_password ~= form.password then | 132 if form.confirm_password ~= form.password then |