Add some content to payment page
This commit is contained in:
@@ -56,7 +56,7 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error("Error:", error);
|
console.error(error);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
|
|
||||||
<main>
|
<main>
|
||||||
<h1>Payment page</h1>
|
<h1>Payment page</h1>
|
||||||
|
<input id="amount-input" placeholder="Amount">
|
||||||
|
<button>Pay</button>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -46,13 +46,12 @@ public class Main {
|
|||||||
|
|
||||||
System.out.println("Received POST data:\n" + body);
|
System.out.println("Received POST data:\n" + body);
|
||||||
|
|
||||||
String response = "Unauthorized";
|
|
||||||
if(authorizedClients.isAuthorized(client)){
|
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();
|
exchange.getResponseBody().close();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -75,7 +74,6 @@ public class Main {
|
|||||||
exchange.sendResponseHeaders(200, data.length);
|
exchange.sendResponseHeaders(200, data.length);
|
||||||
send(exchange, data);
|
send(exchange, data);
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
ioe.printStackTrace();
|
|
||||||
exchange.getResponseHeaders().add("Content-Type", "text/html; charset=UTF-8");
|
exchange.getResponseHeaders().add("Content-Type", "text/html; charset=UTF-8");
|
||||||
exchange.sendResponseHeaders(404, 0);
|
exchange.sendResponseHeaders(404, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user