mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 10:54:52 +00:00
Add fetch button to retrieve certifiate from domain provided #289
This commit is contained in:
@@ -135,4 +135,32 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include("add_certificate_modal.php"); ?>
|
||||
<?php include("add_certificate_modal.php"); ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
function fetchSSL()
|
||||
{
|
||||
// Get the domain name input
|
||||
var domain = document.getElementById("domain").value;
|
||||
|
||||
//Send a GET request to post.php as post.php?fetch_certificate=TRUE&domain=DOMAIN
|
||||
jQuery.get(
|
||||
"post.php",
|
||||
{fetch_certificate: 'TRUE', domain: domain},
|
||||
function(data){
|
||||
//If we get a response from post.php, parse it as JSON
|
||||
const ssl_data = JSON.parse(data);
|
||||
|
||||
if(ssl_data.success == "TRUE"){
|
||||
// Fill the form fields with the cert data
|
||||
document.getElementById("issued_by").value = ssl_data.issued_by;
|
||||
document.getElementById("expire").value = ssl_data.expire;
|
||||
document.getElementById("public_key").value = ssl_data.public_key;
|
||||
}
|
||||
else{
|
||||
alert("Error whilst parsing/retrieving details for domain")
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user