-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathapp.js
33 lines (25 loc) · 878 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Implementing the PIN validation using Client side Javascript is NOT recommended.
// Validate the PIN using server side logic only.
// This is just a demo. The secret key is 1234 for %"£%$ sake ! :)
// CORS has been disabled on purpose to discourage client side use of this script.
$(init);
function init() {
$("#btnValidate").bind("click", btnValidate_click);
$(document).on('shown.bs.modal',
function(e) {
$(".modal-backdrop").remove();
});
}
function btnValidate_click(e) {
var pin = $("#pin").val();
// PLEASE USE A LONGER KEY AND MAKE IT USER-SPECIFIC!
var url = "/Validate.aspx?Pin=" + pin + "&SecretCode=1234";
$.get(url, function(data) {
if (data === "True") {
bootbox.alert("Access granted");
} else
bootbox.alert("Access denied");
}
);
e.preventDefault();
}