Mercurial > prosody-hg
comparison plugins/mod_register.lua @ 665:09e0e9c722a3
Add allow_registration option to disable account registration
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Mon, 29 Dec 2008 23:36:24 +0000 |
| parents | 4ae3e81513f3 |
| children | e901a0709005 |
comparison
equal
deleted
inserted
replaced
| 664:30ccc5e3d8c8 | 665:09e0e9c722a3 |
|---|---|
| 92 session.send(st.error_reply(stanza, "cancel", "service-unavailable")); | 92 session.send(st.error_reply(stanza, "cancel", "service-unavailable")); |
| 93 end; | 93 end; |
| 94 end); | 94 end); |
| 95 | 95 |
| 96 module:add_iq_handler("c2s_unauthed", "jabber:iq:register", function (session, stanza) | 96 module:add_iq_handler("c2s_unauthed", "jabber:iq:register", function (session, stanza) |
| 97 if stanza.tags[1].name == "query" then | 97 if config.get(module.host, "core", "allow_registration") == false then |
| 98 session.send(st.error_reply(stanza, "cancel", "service-unavailable")); | |
| 99 elseif stanza.tags[1].name == "query" then | |
| 98 local query = stanza.tags[1]; | 100 local query = stanza.tags[1]; |
| 99 if stanza.attr.type == "get" then | 101 if stanza.attr.type == "get" then |
| 100 local reply = st.reply(stanza); | 102 local reply = st.reply(stanza); |
| 101 reply:tag("query", {xmlns = "jabber:iq:register"}) | 103 reply:tag("query", {xmlns = "jabber:iq:register"}) |
| 102 :tag("instructions"):text("Choose a username and password for use with this service."):up() | 104 :tag("instructions"):text("Choose a username and password for use with this service."):up() |
| 130 end | 132 end |
| 131 else | 133 else |
| 132 session.send(st.error_reply(stanza, "cancel", "service-unavailable")); | 134 session.send(st.error_reply(stanza, "cancel", "service-unavailable")); |
| 133 end; | 135 end; |
| 134 end); | 136 end); |
| 137 |
