Mercurial > prosody-hg
comparison plugins/mod_legacyauth.lua @ 6302:76699a0ae4c4
mod_lastactivity, mod_legacyauth, mod_presence, mod_saslauth, mod_tls: Use the newer stanza:get_child APIs and optimize away some table lookups
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 04 Jul 2014 22:52:34 +0200 |
| parents | bd0ff8ae98a8 |
| children | edc63dc72566 |
comparison
equal
deleted
inserted
replaced
| 6301:2fdd71b08126 | 6302:76699a0ae4c4 |
|---|---|
| 42 if secure_auth_only and not session.secure then | 42 if secure_auth_only and not session.secure then |
| 43 session.send(st.error_reply(stanza, "modify", "not-acceptable", "Encryption (SSL or TLS) is required to connect to this server")); | 43 session.send(st.error_reply(stanza, "modify", "not-acceptable", "Encryption (SSL or TLS) is required to connect to this server")); |
| 44 return true; | 44 return true; |
| 45 end | 45 end |
| 46 | 46 |
| 47 local username = stanza.tags[1]:child_with_name("username"); | 47 local query = stanza.tags[1]; |
| 48 local password = stanza.tags[1]:child_with_name("password"); | 48 local username = query:get_child("username"); |
| 49 local resource = stanza.tags[1]:child_with_name("resource"); | 49 local password = query:get_child("password"); |
| 50 local resource = query:get_child("resource"); | |
| 50 if not (username and password and resource) then | 51 if not (username and password and resource) then |
| 51 local reply = st.reply(stanza); | 52 local reply = st.reply(stanza); |
| 52 session.send(reply:query("jabber:iq:auth") | 53 session.send(reply:query("jabber:iq:auth") |
| 53 :tag("username"):up() | 54 :tag("username"):up() |
| 54 :tag("password"):up() | 55 :tag("password"):up() |
