diff src/account.html.luan @ 83:a47036fd0158

group chat
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 11 Mar 2025 13:56:59 -0600
parents e4e331539146
children 625ffdf6499d
line wrap: on
line diff
--- a/src/account.html.luan	Mon Mar 10 22:42:46 2025 -0600
+++ b/src/account.html.luan	Tue Mar 11 13:56:59 2025 -0600
@@ -47,9 +47,8 @@
 
 			function saveUsername() {
 				let dialog = document.querySelector('dialog[edit_username]');
-				let input = dialog.querySelector('input[name=username]');
-				username = input.value;
-				closeModal(input);
+				closeModal(dialog);
+				username = dialog.querySelector('input[name=username]').value;
 				showUsername();
 				ajax(`save_username.js?username=${encodeURIComponent(username)}`);
 			}
@@ -70,11 +69,10 @@
 
 			function saveNotify() {
 				let dialog = document.querySelector('dialog[edit_notify]');
-				let input = dialog.querySelector('input[name=notify_email]');
-				notifyEmail = input.value;
+				closeModal(dialog);
+				notifyEmail = dialog.querySelector('input[name=notify_email]').value;
 				let radio = dialog.querySelector('input[type=radio]:checked');
 				multiNotify = radio.value === 'true';
-				closeModal(input);
 				showNotify();
 				ajax(`save_notify.js?email=${encodeURIComponent(notifyEmail)}&multi=${multiNotify}`);
 			}
@@ -93,9 +91,8 @@
 
 			function saveVoice() {
 				let dialog = document.querySelector('dialog[edit_voice]');
-				let input = dialog.querySelector('input[name=voice]');
-				voice = input.value;
-				closeModal(input);
+				closeModal(dialog);
+				voice = dialog.querySelector('input[name=voice]').value;
 				showVoice();
 				ajax(`save_voice.js?url=${encodeURIComponent(voice)}`);
 			}
@@ -219,7 +216,7 @@
 		</dialog>
 		<dialog url>
 			<h2>Your chat URL</h2>
-			<p><%= base_url() %>/chat?with=<%=user.email%></p>
+			<p><%= base_url() %>/chat?with=<%=html_encode(user.email)%></p>
 			<p>Use this URL to link to your chat so that other people can chat with you by clicking on the link.</p>
 			<div buttons>
 				<button onclick="closeModal(this)">Close</button>