Mercurial > prosody-hg
comparison plugins/muc/password.lib.lua @ 10447:b5fd1637f15c
MUC: Indicate origin of password related errors
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 25 Nov 2019 23:47:49 +0100 |
| parents | c62c983b8be3 |
| children | 5fb16f41f861 |
comparison
equal
deleted
inserted
replaced
| 10446:5c2d1b13537c | 10447:b5fd1637f15c |
|---|---|
| 48 local password = muc_x:get_child_text("password", "http://jabber.org/protocol/muc"); | 48 local password = muc_x:get_child_text("password", "http://jabber.org/protocol/muc"); |
| 49 if not password or password == "" then password = nil; end | 49 if not password or password == "" then password = nil; end |
| 50 if get_password(room) ~= password then | 50 if get_password(room) ~= password then |
| 51 local from, to = stanza.attr.from, stanza.attr.to; | 51 local from, to = stanza.attr.from, stanza.attr.to; |
| 52 module:log("debug", "%s couldn't join due to invalid password: %s", from, to); | 52 module:log("debug", "%s couldn't join due to invalid password: %s", from, to); |
| 53 local reply = st.error_reply(stanza, "auth", "not-authorized"):up(); | 53 local reply = st.error_reply(stanza, "auth", "not-authorized", nil, room.jid):up(); |
| 54 reply.tags[1].attr.code = "401"; | 54 reply.tags[1].attr.code = "401"; |
| 55 event.origin.send(reply:tag("x", {xmlns = "http://jabber.org/protocol/muc"})); | 55 event.origin.send(reply:tag("x", {xmlns = "http://jabber.org/protocol/muc"})); |
| 56 return true; | 56 return true; |
| 57 end | 57 end |
| 58 end, -20); | 58 end, -20); |
