mirror of
https://github.com/csd4ni3l/grass_touching_captcha.git
synced 2026-01-01 12:33:45 +01:00
Add grass touching bans (which dont work yet), grass touching submit page which if used, increments the grass touching count and last grass touching, make it so only one error shows up if it fails and multiple errors cant.
This commit is contained in:
@@ -50,10 +50,12 @@
|
||||
<label class="form-label" for="file_input">Grass touching proof</label>
|
||||
<div id="challengehelp">To complete this challenge, you need to submit a picture of you touching grass next to a paper containing the following text: Loading...</div>
|
||||
<input accept="image/png, image/jpeg" name="file" type="file" class="form-control" id="file_input">
|
||||
<div hidden id="error-label" class="text-danger"></div>
|
||||
</div>
|
||||
|
||||
<small id="proofhelp" class="form-text text-muted">Dont worry! We wont tell your friends.</small>
|
||||
</div>
|
||||
|
||||
<button id="submit" type="button" class="btn btn-primary mx-auto d-block" style="width: 100%; margin-top: 4%;">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
@@ -64,6 +66,8 @@ function upload_success(image_url) {
|
||||
document.getElementById("submit").disabled = false;
|
||||
document.getElementById("submit").innerHTML = "Submit"
|
||||
document.getElementById("submit").type = "submit"
|
||||
document.getElementById("error-label").textContent = ""
|
||||
document.getElementById("error-label").hidden = true;
|
||||
|
||||
document.getElementById("grass-touching-form").innerHTML += `<img class="preview-img" src="${image_url}">`;
|
||||
}
|
||||
@@ -76,15 +80,15 @@ function upload_error(error_message) {
|
||||
|
||||
document.getElementById("submit").innerHTML = "Submit"
|
||||
document.getElementById("submit").disabled = false;
|
||||
document.getElementById("grass-touching-form").innerHTML += `<div class="text-danger">${error_message}</div>`;
|
||||
|
||||
document.getElementById("error-label").textContent = error_message;
|
||||
document.getElementById("error-label").hidden = false;
|
||||
}
|
||||
|
||||
function upload_file(file_type, file_content) {
|
||||
username_input = document.getElementById("usernameinput").value
|
||||
username_input = document.getElementById("usernameinput")
|
||||
fetch('{{ url_for("submit_challenge") }}', {
|
||||
method: "POST",
|
||||
body: JSON.stringify({image_data: file_content, image_type: file_type, username: username_input}),
|
||||
body: JSON.stringify({image_data: file_content, image_type: file_type, username: username_input.value}),
|
||||
headers: {
|
||||
"Content-type": "application/json"
|
||||
}
|
||||
@@ -131,7 +135,8 @@ function read_file () {
|
||||
file_type = "png";
|
||||
}
|
||||
else {
|
||||
document.getElementById("grass-touching-form").textContent += `<div class="text-danger">Only JPEG and PNG is supported.</div>`;
|
||||
document.getElementById("error-label").textContent = "Only JPEG and PNG is supported."
|
||||
document.getElementById("error-label").hidden = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user