diff --git a/assets/pages/index.html b/assets/pages/index.html index 4096204..95bc87f 100644 --- a/assets/pages/index.html +++ b/assets/pages/index.html @@ -100,15 +100,17 @@ btnPay.addEventListener("click", async() => { let token = document.getElementById("token-input").value; - let dataToken = { token: token }; + let creds = JSON.parse(localStorage.getItem("creds")); + await fetch("/payment", { method: "POST", headers: { - "Content-Type": "application/json" + "Content-Type": "application/json", + "Authorization": `Basic ${creds.username}:${creds.password}` }, body: JSON.stringify(dataToken) }) diff --git a/assets/pages/payment.html b/assets/pages/payment.html deleted file mode 100644 index 3356b12..0000000 --- a/assets/pages/payment.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - MASI 3DSecure - - - - - -
- -
- - - - \ No newline at end of file diff --git a/src/main/java/httpServer/httpServer/src/handlers/RequestHandler.java b/src/main/java/httpServer/httpServer/src/handlers/RequestHandler.java index c6237ac..a7b39e6 100644 --- a/src/main/java/httpServer/httpServer/src/handlers/RequestHandler.java +++ b/src/main/java/httpServer/httpServer/src/handlers/RequestHandler.java @@ -41,6 +41,7 @@ public class RequestHandler implements IRequestHandler { } } + @OnlyAuthorizedClients @AllowedVerb(name = "POST") public void handlePayment(HttpExchange exchange) { Logger.displayReceived("/payment request");