Skip to content

Commit

Permalink
Don't allow empty names
Browse files Browse the repository at this point in the history
  • Loading branch information
SnowpMakes committed Mar 26, 2024
1 parent 3d1fa06 commit f98d889
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f98d889

Please sign in to comment.