mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
More regex
This commit is contained in:
parent
241a33542b
commit
4707489310
@ -151,14 +151,20 @@
|
||||
if (e.keyCode === 13) {
|
||||
let word = document.getElementById("searchbox").value
|
||||
word = word.toLowerCase();
|
||||
word = word.replace(/[`'"]/gi, " ")
|
||||
safe_word = sanitize(word)
|
||||
if (word === "\\n") {
|
||||
if (word.includes("\\n")) {
|
||||
window.alert("Nice try...");
|
||||
document.getElementById("searchbox").value = "";
|
||||
return;
|
||||
}
|
||||
if (!safe_word) {
|
||||
window.alert("Illegal character detected")
|
||||
window.alert("Illegal character detected");
|
||||
document.getElementById("searchbox").value = "";
|
||||
return;
|
||||
} else if (safe_word.startsWith(" ")) {
|
||||
window.alert("Illegal first character");
|
||||
document.getElementById("searchbox").value = "";
|
||||
return;
|
||||
}
|
||||
words.push(word);
|
||||
|
Loading…
Reference in New Issue
Block a user