party: sanitize passphrase inputs

This commit is contained in:
Adam
2022-06-21 19:05:58 -04:00
parent a9d89f058b
commit 73116f35f3

View File

@@ -165,6 +165,19 @@ class PartyPanel extends PluginPanel
return;
}
for (int i = 0; i < s.length(); ++i)
{
char ch = s.charAt(i);
if (!Character.isLetter(ch) && !Character.isDigit(ch) && ch != '-')
{
JOptionPane.showMessageDialog(joinPartyButton,
"Party passphrase must be a combination of alphanumeric or hyphen characters.",
"Invalid party passphrase",
JOptionPane.ERROR_MESSAGE);
return;
}
}
party.changeParty(s);
}
});