Comparison

mod_conversejs/mod_conversejs.lua @ 6310:30adcea825c3

mod_conversejs: Fix hostname set as default username (thanks roughnecks) In login mode, it seems jid is used as default value in the login field but it was only needed in anonymous mode.
author Kim Alvefur <zash@zash.se>
date Wed, 18 Jun 2025 14:28:38 +0200
parent 6241:303fcfe3a7e8
comparison
equal deleted inserted replaced
6308:e1c54de06905 6310:30adcea825c3
72 end 72 end
73 73
74 local function get_converse_options() 74 local function get_converse_options()
75 local user_options = module:get_option("conversejs_options"); 75 local user_options = module:get_option("conversejs_options");
76 76
77 local authentication = module:get_option_string("authentication");
77 local allow_registration = module:get_option_boolean("allow_registration", false); 78 local allow_registration = module:get_option_boolean("allow_registration", false);
78 local converse_options = { 79 local converse_options = {
79 -- Auto-detected connection endpoints 80 -- Auto-detected connection endpoints
80 bosh_service_url = has_bosh and module:http_url("bosh","/http-bind") or nil; 81 bosh_service_url = has_bosh and module:http_url("bosh","/http-bind") or nil;
81 websocket_url = has_ws and module:http_url("websocket","xmpp-websocket"):gsub("^http", "ws") or nil; 82 websocket_url = has_ws and module:http_url("websocket","xmpp-websocket"):gsub("^http", "ws") or nil;
82 -- Since we provide those, XEP-0156 based auto-discovery should not be used 83 -- Since we provide those, XEP-0156 based auto-discovery should not be used
83 discover_connection_methods = false; 84 discover_connection_methods = false;
84 -- Authentication mode to use (normal or guest login) 85 -- Authentication mode to use (normal or guest login)
85 authentication = module:get_option_string("authentication") == "anonymous" and "anonymous" or "login"; 86 authentication = authentication == "anonymous" and "anonymous" or "login";
86 -- Host to connect to for anonymous access 87 -- Host to connect to for anonymous access
87 jid = module.host; 88 jid = authentication == "anonymous" and module.host or nil;
88 -- Let users login with only username 89 -- Let users login with only username
89 default_domain = module.host; 90 default_domain = module.host;
90 domain_placeholder = module.host; 91 domain_placeholder = module.host;
91 -- If registration is enabled 92 -- If registration is enabled
92 allow_registration = allow_registration; 93 allow_registration = allow_registration;