changeset 4268:871d140d61bb

mod_adhoc_oauth2_client: Fix including final client_id in result form The client_id is composed of the details needed for retrieving the data, making it redundant to include in the data, albeit somewhat convenient sometimes. Decided to remove it anyways, but forgot to change the result.
author Kim Alvefur <zash@zash.se>
date Sun, 22 Nov 2020 17:00:26 +0100
parents 43284437c5ed
children 143515d0b212
files mod_adhoc_oauth2_client/mod_adhoc_oauth2_client.lua
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mod_adhoc_oauth2_client/mod_adhoc_oauth2_client.lua	Sun Nov 22 16:54:50 2020 +0100
+++ b/mod_adhoc_oauth2_client/mod_adhoc_oauth2_client.lua	Sun Nov 22 17:00:26 2020 +0100
@@ -43,7 +43,8 @@
 	end
 
 	local creator = jid.split(data.from);
-	local client_id = id.short();
+	local client_uid = id.short();
+	local client_id = jid.join(creator, module.host, client_uid);
 	local client_secret = id.long();
 	local salt = id.medium();
 	local i = iteration_count;
@@ -52,11 +53,11 @@
 	client.iteration_count = i;
 	client.salt = salt;
 
-	local ok, err = errors.coerce(clients:set(creator, client_id, client));
+	local ok, err = errors.coerce(clients:set(creator, client_uid, client));
 	module:log("info", "OAuth2 client %q created by %s", client_id, data.from);
 	if not ok then return {status = "canceled"; error = {message = err}}; end
 
-	return {status = "completed"; result = {layout = client_created; values = {client_id = client.client_id; client_secret = client_secret}}};
+	return {status = "completed"; result = {layout = client_created; values = {client_id = client_id; client_secret = client_secret}}};
 end
 
 local handler = adhoc.new_simple_form(new_client, create_client);