17 local sessionmanager = require "core.sessionmanager"; |
17 local sessionmanager = require "core.sessionmanager"; |
18 local usermanager = require "core.usermanager"; |
18 local usermanager = require "core.usermanager"; |
19 |
19 |
20 module:add_feature("jabber:iq:auth"); |
20 module:add_feature("jabber:iq:auth"); |
21 module:add_event_hook("stream-features", function (session, features) |
21 module:add_event_hook("stream-features", function (session, features) |
22 if not session.username then features:tag("auth", {xmlns='http://jabber.org/features/iq-auth'}):up(); end |
22 if secure_auth_only and not session.secure then |
|
23 -- Sorry, not offering to insecure streams! |
|
24 return; |
|
25 elseif not session.username then |
|
26 features:tag("auth", {xmlns='http://jabber.org/features/iq-auth'}):up(); |
|
27 end |
23 end); |
28 end); |
24 |
29 |
25 module:add_iq_handler("c2s_unauthed", "jabber:iq:auth", |
30 module:add_iq_handler("c2s_unauthed", "jabber:iq:auth", |
26 function (session, stanza) |
31 function (session, stanza) |
27 if secure_auth_only and not session.secure then |
32 if secure_auth_only and not session.secure then |