From f98d8897e488fc0dc1cfc923d7bf39eaa696b082 Mon Sep 17 00:00:00 2001 From: Snowp Date: Tue, 26 Mar 2024 16:44:48 +0100 Subject: [PATCH] Don't allow empty names --- src/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.html b/src/index.html index 1911cbe..8219b40 100644 --- a/src/index.html +++ b/src/index.html @@ -49,10 +49,10 @@ let xhrProcessCount = 0; let endSubmitted = false; let playerNameChange = function() { - let name; + let name = "Unknown"; do { name = prompt("Enter your name: "); - } while(!/^[a-zA-Z0-9!?\-_ ]+$/.test(name)); + } while(!name || !/^[a-zA-Z0-9!?\-_ ]+$/.test(name)); localStorage.setItem("playerName", name); window.location.reload(); return name;