diff src/invite.js.luan @ 83:a47036fd0158

group chat
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 11 Mar 2025 13:56:59 -0600
parents 3521166513b3
children 7b339b1ccd11
line wrap: on
line diff
--- a/src/invite.js.luan	Mon Mar 10 22:42:46 2025 -0600
+++ b/src/invite.js.luan	Tue Mar 11 13:56:59 2025 -0600
@@ -2,8 +2,10 @@
 local error = Luan.error
 local Parsers = require "luan:Parsers.luan"
 local json_string = Parsers.json_string or error()
+local Html = require "luan:Html.luan"
+local url_encode = Html.url_encode or error()
+local Io = require "luan:Io.luan"
 local Http = require "luan:http/Http.luan"
-local Io = require "luan:Io.luan"
 local User = require "site:/lib/User.luan"
 local get_user_by_email = User.get_by_email or error()
 local get_or_create_user_by_email = User.get_or_create_by_email or error()
@@ -20,13 +22,13 @@
 	Io.stdout = Http.response.text_writer()
 	if get_user_by_email(email) ~= nil then
 %>
-		location = 'chat?with=<%=email%>';
+		location = 'chat?with=<%=url_encode(email)%>';
 <%
 		return
 	end
 	local invitee = get_or_create_user_by_email(email)
 	local password = invitee.password
-	local url = base_url().."/do_login.html?user="..invitee.id.."&password="..password.."&with="..user.email
+	local url = base_url().."/do_login.html?user="..invitee.id.."&password="..password.."&with="..url_encode(user.email)
 	local who = user.name or user.email
 	send_mail {
 		To = email