-
Tomasz Wolniewicz authoredTomasz Wolniewicz authored
otp_code.php 1.54 KiB
<?php
eduGAIN_manage_gui::pageGraphics();
$repeatText = '';
if (isset($_GET['repeat'])) {
$repeatText = "<b>The last code you entered failed. </b><p>";
}
print '<div style="margin-left: 2em; margin-top:4ex">';
print "<h1>Additional verification required</h1><p>";
print '<form id="otpform" action="'.ROOT_URL.'/manage" method = POST>';
print $repeatText."Remember that the code can only be used once, if you have already used it you need to wait for the new one to be generated by your device."
. "<p>Please enter your validation code: "
. '<input type="text" size=6 name="second_factor" id="second_factor"> '
. '<button id="otpsubmit" class="ui-button ui-corner-all ui-widget">Submit</button>'
. ' '
. '<button id="otpcancel" class="ui-button ui-corner-all ui-widget">Cancel</button>'
. '<input type="hidden" name ="otpstatus" id="otpstatus" value="1"/ >'
;
print '</form></div>';
print '<script>
window.onload = function() {
document.getElementById("second_factor").focus();
};
$("#otpsubmit").on("click", function(event) {
event.preventDefault();
if(!$("#second_factor").val().match(/\d\d\d\d\d\d/)) {
alert("The code needs to be 6 digits");
return false;
}
$("#otpform").submit();
});
$("#otpcancel").on("click", function(event) {
event.preventDefault();
$("#second_factor").val("");
$("#otpstatus").val("0");
$("#otpform").submit();
});
</script>';