78 lines
2.3 KiB
HTML
78 lines
2.3 KiB
HTML
<%page expression_filter="h"/>
|
|
<%namespace name='static' file='/static_content.html'/>
|
|
<%! from openedx.core.djangolib.js_utils import js_escaped_string %>
|
|
<html>
|
|
<head><title>Fake Software Secure Form</title>
|
|
</head>
|
|
<body>
|
|
<p>Fake Software Secure page</p>
|
|
<p>It will pick the most recent software secure attempt for a logged-in user.</p>
|
|
|
|
<br>
|
|
<div>
|
|
<input type="button" value="PASS" id="btn_pass">
|
|
<input type="button" value="FAIL" id="btn_denied" style="margin-left: 10px">
|
|
<input type="button" value="SYSTEM FAIL" id="btn_error" style="margin-left: 10px">
|
|
<input type="button" value="UNKNOWN ERROR" id="btn_unknown_error" style="margin-left: 10px">
|
|
</div>
|
|
|
|
<div id="errors-info" style="padding-top: 20px;color: red"></div>
|
|
<div id="success-info" style="padding-top: 20px;color: green"></div>
|
|
|
|
</body>
|
|
</html>
|
|
<script type="text/javascript" src="${static.url('common/js/vendor/jquery.js')}"></script>
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready(function() {
|
|
|
|
$("#btn_pass").click(function(e){
|
|
e.preventDefault();
|
|
ajax_post($(this).val(),"");
|
|
});
|
|
$("#btn_denied").click(function(e){
|
|
e.preventDefault();
|
|
ajax_post($(this).val(),"failure");
|
|
});
|
|
$("#btn_error").click(function(e){
|
|
e.preventDefault();
|
|
ajax_post($(this).val(),"system error");
|
|
});
|
|
$("#btn_unknown_error").click(function(e){
|
|
e.preventDefault();
|
|
ajax_post($(this).val(),"unknown system error");
|
|
});
|
|
|
|
|
|
function ajax_post(status, reason){
|
|
|
|
var data = {
|
|
"EdX-ID": '${receipt_id | n, js_escaped_string}',
|
|
"Result": status,
|
|
"Reason": reason,
|
|
"MessageType": ""
|
|
};
|
|
|
|
$('#errors-info').html('');
|
|
$('#success-info').html('');
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: '${results_callback | n, js_escaped_string}',
|
|
headers: {
|
|
"Authorization": "${authorization_code | n, js_escaped_string}"
|
|
},
|
|
data: JSON.stringify(data),
|
|
contentType: "application/json;",
|
|
success: function () {
|
|
$('#success-info').text('status updated.');
|
|
},
|
|
error: function(jqXHR, textStatus, errorThrown) {
|
|
$('#errors-info').text(jqXHR.responseText);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
</script>
|