Diff

mod_conversejs/mod_conversejs.lua @ 6344:eb834f754f57 draft default tip

Merge update
author Trần H. Trung <xmpp:trần.h.trung@trung.fun>
date Fri, 18 Jul 2025 20:45:38 +0700
parent 6310:30adcea825c3
line wrap: on
line diff
--- a/mod_conversejs/mod_conversejs.lua	Sun Jun 15 01:08:46 2025 +0700
+++ b/mod_conversejs/mod_conversejs.lua	Fri Jul 18 20:45:38 2025 +0700
@@ -74,6 +74,7 @@
 local function get_converse_options()
 	local user_options = module:get_option("conversejs_options");
 
+	local authentication = module:get_option_string("authentication");
 	local allow_registration = module:get_option_boolean("allow_registration", false);
 	local converse_options = {
 		-- Auto-detected connection endpoints
@@ -82,9 +83,9 @@
 		-- Since we provide those, XEP-0156 based auto-discovery should not be used
 		discover_connection_methods = false;
 		-- Authentication mode to use (normal or guest login)
-		authentication = module:get_option_string("authentication") == "anonymous" and "anonymous" or "login";
+		authentication = authentication == "anonymous" and "anonymous" or "login";
 		-- Host to connect to for anonymous access
-		jid = module.host;
+		jid = authentication == "anonymous" and module.host or nil;
 		-- Let users login with only username
 		default_domain = module.host;
 		domain_placeholder = module.host;