Diff

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
line wrap: on
line diff
--- a/mod_conversejs/mod_conversejs.lua	Fri Jun 13 21:57:38 2025 +0200
+++ b/mod_conversejs/mod_conversejs.lua	Wed Jun 18 14:28:38 2025 +0200
@@ -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;