Mercurial > prosody-modules
comparison mod_register_web/mod_register_web.lua @ 2923:9d53134a0b29
mod_register_web: Return reason for rejection if one was provided by another plugin during pre-registration checks
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 10 Mar 2018 02:39:54 +0100 |
parents | 9f60905406ba |
children | edf5e8a77d0c |
comparison
equal
deleted
inserted
replaced
2922:9f60905406ba | 2923:9d53134a0b29 |
---|---|
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, ip = origin.conn:ip(), 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, registering.reason or "Registration not allowed"; |
131 end | 131 end |
132 if form.confirm_password ~= form.password then | 132 if form.confirm_password ~= form.password then |
133 return nil, "Passwords don't match"; | 133 return nil, "Passwords don't match"; |
134 end | 134 end |
135 local ok, err = usermanager.create_user(prepped_username, form.password, module.host); | 135 local ok, err = usermanager.create_user(prepped_username, form.password, module.host); |