fixed pbm in room name check

This commit is contained in:
simplonco
2023-01-10 10:32:46 +01:00
parent 89ffe9d4a3
commit 223599542b
4 changed files with 276 additions and 236 deletions

View File

@@ -9,13 +9,13 @@
export let back = "";
let allowed_chars = 'loading...';
let regex;
//let regex;
onMount(async() => {
let response = await fetch('/api/v2/chat/allowedchars');
let data = await response.json();
console.log("data:", data);
allowed_chars = data.chars;
regex = new RegExp(`^[a-zA-Z0-9\\s${allowed_chars}]+$`);
//regex = new RegExp(`^[a-zA-Z0-9\\s${allowed_chars}]+$`);
});
let room_name: string;
@@ -68,7 +68,10 @@
{/if}
<!-- name: -->
<label for="chat_name"><p>new room name :</p></label>
<!--
<input id="chat_name" bind:value={room_name} name="room_name" placeholder="allowed special characters: {allowed_chars}" pattern={regex} required>
-->
<input id="chat_name" bind:value={room_name} name="room_name" placeholder="allowed special characters: {allowed_chars}" required>
<!-- [ ] pubic -->
<label for="chat_public" class="_radio">
<p>public</p>