Mercurial > prosody-modules
comparison mod_register_redirect/mod_register_redirect.lua @ 807:7d1d3ca31d03
mod_register_redirect: rebacked in changeset c6f1427da79d (behaviour fixed).
author | Marco Cirillo <maranda@lightwitch.org> |
---|---|
date | Sun, 26 Aug 2012 23:34:36 +0000 |
parents | 7e474c7f450a |
children | aa93cf0b1242 |
comparison
equal
deleted
inserted
replaced
806:d15a9eaa63ea | 807:7d1d3ca31d03 |
---|---|
34 inst_text = "Please contact "..module:get_host().."'s server administrator via xmpp to register an account on this server at: "..url:match("^%w+[:](.*)$") | 34 inst_text = "Please contact "..module:get_host().."'s server administrator via xmpp to register an account on this server at: "..url:match("^%w+[:](.*)$") |
35 else | 35 else |
36 module:log("error", "This module supports only http/https, mailto or xmpp as URL formats.") | 36 module:log("error", "This module supports only http/https, mailto or xmpp as URL formats.") |
37 module:log("error", "If you want to use personalized instructions without an Out-Of-Band method,") | 37 module:log("error", "If you want to use personalized instructions without an Out-Of-Band method,") |
38 module:log("error", "specify: register_oob = false; -- in your configuration along your banner string (register_text).") | 38 module:log("error", "specify: register_oob = false; -- in your configuration along your banner string (register_text).") |
39 origin.send(st.error_reply(stanza, "wait", "internal-server-error")) ; return true -- bouncing request. | 39 return origin.send(st.error_reply(stanza, "wait", "internal-server-error")) -- bouncing request. |
40 end | 40 end |
41 else | 41 else |
42 module:log("error", "Please check your configuration, the URL you specified is invalid") | 42 module:log("error", "Please check your configuration, the URL you specified is invalid") |
43 origin.send(st.error_reply(stanza, "wait", "internal-server-error")) ; return true -- bouncing request. | 43 return origin.send(st.error_reply(stanza, "wait", "internal-server-error")) -- bouncing request. |
44 end | 44 end |
45 else | 45 else |
46 if admins_l then | 46 if admins_l then |
47 local ajid; for _,v in ipairs(admins_l) do ajid = v ; break end | 47 local ajid; for _,v in ipairs(admins_l) do ajid = v ; break end |
48 inst_text = "Please contact "..module:get_host().."'s server administrator via xmpp to register an account on this server at: "..ajid | 48 inst_text = "Please contact "..module:get_host().."'s server administrator via xmpp to register an account on this server at: "..ajid |
51 local ajid; for _,v in ipairs(admins_g) do ajid = v ; break end | 51 local ajid; for _,v in ipairs(admins_g) do ajid = v ; break end |
52 inst_text = "Please contact "..module:get_host().."'s server administrator via xmpp to register an account on this server at: "..ajid | 52 inst_text = "Please contact "..module:get_host().."'s server administrator via xmpp to register an account on this server at: "..ajid |
53 else | 53 else |
54 module:log("error", "Please be sure to, _at the very least_, configure one server administrator either global or hostwise...") | 54 module:log("error", "Please be sure to, _at the very least_, configure one server administrator either global or hostwise...") |
55 module:log("error", "if you want to use this module, or read it's configuration wiki at: http://code.google.com/p/prosody-modules/wiki/mod_register_redirect") | 55 module:log("error", "if you want to use this module, or read it's configuration wiki at: http://code.google.com/p/prosody-modules/wiki/mod_register_redirect") |
56 origin.send(st.error_reply(stanza, "wait", "internal-server-error")) ; return true -- bouncing request. | 56 return origin.send(st.error_reply(stanza, "wait", "internal-server-error")) -- bouncing request. |
57 end | 57 end |
58 end | 58 end |
59 end | 59 end |
60 elseif inst_text and url and oob then | 60 elseif inst_text and url and oob then |
61 if not url:match("^%w+[:].*$") then | 61 if not url:match("^%w+[:].*$") then |
62 module:log("error", "Please check your configuration, the URL specified is not valid.") | 62 module:log("error", "Please check your configuration, the URL specified is not valid.") |
63 origin.send(st.error_reply(stanza, "wait", "internal-server-error")) ; return true -- bouncing request. | 63 return origin.send(st.error_reply(stanza, "wait", "internal-server-error")) -- bouncing request. |
64 end | 64 end |
65 end | 65 end |
66 | 66 |
67 if not no_wl then | 67 if not no_wl then |
68 for i,ip in ipairs(ip_wl) do | 68 for i,ip in ipairs(ip_wl) do |
82 reply:query("jabber:iq:register") | 82 reply:query("jabber:iq:register") |
83 :tag("instructions"):text(inst_text):up() | 83 :tag("instructions"):text(inst_text):up() |
84 end | 84 end |
85 | 85 |
86 if stanza.attr.type == "get" then | 86 if stanza.attr.type == "get" then |
87 origin.send(reply) | 87 return origin.send(reply) |
88 else | 88 else |
89 origin.send(st.error_reply(stanza, "cancel", "not-authorized")) | 89 return origin.send(st.error_reply(stanza, "cancel", "not-authorized")) |
90 end | 90 end |
91 return true | |
92 end | 91 end |
93 | 92 |
94 module:hook("stanza/iq/jabber:iq:register:query", reg_redirect, 10) | 93 module:hook("stanza/iq/jabber:iq:register:query", reg_redirect, 10) |