Add some content to payment page

This commit is contained in:
Laurent
2025-12-04 09:02:30 +01:00
parent dd7a63c22f
commit 3881a20edd
3 changed files with 6 additions and 6 deletions

View File

@@ -56,7 +56,7 @@
}
})
.catch(error => {
console.error("Error:", error);
console.error(error);
});
});

View File

@@ -24,6 +24,8 @@
<main>
<h1>Payment page</h1>
<input id="amount-input" placeholder="Amount">
<button>Pay</button>
</main>
<script>

View File

@@ -46,13 +46,12 @@ public class Main {
System.out.println("Received POST data:\n" + body);
String response = "Unauthorized";
if(authorizedClients.isAuthorized(client)){
response = "Authorized";
exchange.sendResponseHeaders(200, 0);
} else {
exchange.sendResponseHeaders(401, 0);
}
exchange.sendResponseHeaders(200, response.getBytes().length);
send(exchange, response.getBytes());
exchange.getResponseBody().close();
});
@@ -75,7 +74,6 @@ public class Main {
exchange.sendResponseHeaders(200, data.length);
send(exchange, data);
} catch (IOException ioe) {
ioe.printStackTrace();
exchange.getResponseHeaders().add("Content-Type", "text/html; charset=UTF-8");
exchange.sendResponseHeaders(404, 0);
}