Skip to content
Snippets Groups Projects
Commit 1396e11e authored by FarawayVision's avatar FarawayVision
Browse files

Sanitize input player names by removing all angle brackets

parent a6781951
No related branches found
No related tags found
No related merge requests found
......@@ -423,16 +423,22 @@ function setPlayerTags () {
************************************************************/
function validateTitleScreen () {
/* determine the player's name */
var playerName = '';
if ($nameField.val() != "") {
players[HUMAN_PLAYER].first = $nameField.val();
players[HUMAN_PLAYER].label = $nameField.val();
playerName = $nameField.val();
} else if (players[HUMAN_PLAYER].gender == "male") {
players[HUMAN_PLAYER].first = "Mister";
players[HUMAN_PLAYER].label = "Mister";
playerName = "Mister";
} else if (players[HUMAN_PLAYER].gender == "female") {
players[HUMAN_PLAYER].first = "Missy";
players[HUMAN_PLAYER].label = "Missy";
playerName = 'Missy';
}
// Nuke all angle-brackets
playerName = playerName.replace(/<|>/g, '');
players[HUMAN_PLAYER].first = playerName;
players[HUMAN_PLAYER].label = playerName;
$gameLabels[HUMAN_PLAYER].html(players[HUMAN_PLAYER].label);
/* count clothing */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment