55 lines
2.0 KiB
HTML
55 lines
2.0 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Are you a robot?</title>
|
|
<script
|
|
src="https://code.jquery.com/jquery-3.4.1.min.js"
|
|
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
|
|
crossorigin="anonymous"></script>
|
|
<script src="https://www.google.com/recaptcha/api.js?render={{ site_key }}"></script>
|
|
<script>
|
|
|
|
function getCookie(name) {
|
|
var cookieValue = null;
|
|
if (document.cookie && document.cookie !== '') {
|
|
var cookies = document.cookie.split(';');
|
|
for (var i = 0; i < cookies.length; i++) {
|
|
var cookie = jQuery.trim(cookies[i]);
|
|
// Does this cookie string begin with the name we want?
|
|
if (cookie.substring(0, name.length + 1) === (name + '=')) {
|
|
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
return cookieValue;
|
|
}
|
|
var csrftoken = getCookie('csrftoken');
|
|
|
|
function csrfSafeMethod(method) {
|
|
// these HTTP methods do not require CSRF protection
|
|
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
|
|
}
|
|
$.ajaxSetup({
|
|
beforeSend: function(xhr, settings) {
|
|
if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
|
|
xhr.setRequestHeader("X-CSRFToken", csrftoken);
|
|
}
|
|
}
|
|
});
|
|
|
|
grecaptcha.ready(function() {
|
|
grecaptcha.execute('{{ site_key }}', {action: '{{ object.slug }}'}).then(function(token) {
|
|
$.post("",{'token':token},function(resp){
|
|
window.location = resp;
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<H1>Are you a robot?</H1>
|
|
<p>We need to make sure you are not a robot before proceeding to {{ object.slug }}</p>
|
|
<div class="g-recaptcha" data-sitekey="{{ site_key }}"></div>
|
|
</body>
|
|
</html> |