v1.1
This commit is contained in:
parent
a08c4708e2
commit
4cb2bc7d29
@ -25,7 +25,7 @@
|
||||
const path = window.location.pathname;
|
||||
const parts = path.split("/");
|
||||
const user = parts.pop();
|
||||
let url = location.protocol + "//" + location.host + "/u/" + user;
|
||||
let url = location.protocol + "//" + location.host + "/u/" + user.toLowerCase();
|
||||
|
||||
const qrcode = new QRCode(document.getElementById('qr'), {
|
||||
text: url,
|
||||
@ -39,7 +39,7 @@
|
||||
let qrLink = document.getElementById("qr-link");
|
||||
let qrImg = document.querySelector("#qr img");
|
||||
console.log(qrImg.src);
|
||||
qrLink.setAttribute("download", "qrcode-" + user + ".png");
|
||||
qrLink.setAttribute("download", "qrcode-" + user.toLowerCase() + ".png");
|
||||
|
||||
const delay = ms => new Promise(res => setTimeout(res, ms));
|
||||
const setHref = async () => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const form = document.getElementById("reg-form"); // Replace #my-form with your form's ID
|
||||
const form = document.getElementById("reg-form");
|
||||
|
||||
form.addEventListener("submit", async (event) => {
|
||||
event.preventDefault();
|
||||
|
@ -1,10 +1,10 @@
|
||||
document.getElementById("submitBtn").addEventListener('click', function(e) {
|
||||
let code = document.getElementById("code").value;
|
||||
console.log("Clicked: " + code);
|
||||
let submitBtn = document.getElementById("submitBtn");
|
||||
submitBtn.addEventListener('click', function(e) {
|
||||
let code = document.getElementById("code").value.replaceAll(" ", "");
|
||||
|
||||
const path = window.location.pathname;
|
||||
const parts = path.split("/");
|
||||
const user = parts.pop();
|
||||
const user = parts.pop().toLowerCase();
|
||||
|
||||
fetch("/api/verify/" + user, {
|
||||
method: 'GET',
|
||||
@ -15,8 +15,9 @@ document.getElementById("submitBtn").addEventListener('click', function(e) {
|
||||
}).then(response => response.json())
|
||||
.then(data => {
|
||||
let statusText = document.getElementById("status");
|
||||
console.log(data);
|
||||
statusText.classList.remove("hidden");
|
||||
console.log("Status Code: " + data.status);
|
||||
console.log("Code Type: " + typeof data.status)
|
||||
if (data.status === 404) {
|
||||
// Not found
|
||||
statusText.innerText = "User with that code not found";
|
||||
@ -29,4 +30,10 @@ document.getElementById("submitBtn").addEventListener('click', function(e) {
|
||||
statusText.innerText = "Error, please send this to Steven to be fixed. Error: " + data.error;
|
||||
}
|
||||
})
|
||||
})
|
||||
});
|
||||
|
||||
document.getElementById("code").addEventListener('keyup', function(e) {
|
||||
if (e.key === "Enter") {
|
||||
submitBtn.click();
|
||||
}
|
||||
});
|
Loading…
Reference in New Issue
Block a user