mirror of
https://github.com/pi-hole/web.git
synced 2024-12-06 19:36:21 +01:00
API QR token generator (#410)
* Added API QR token generator * Pass only token * Corrected link
This commit is contained in:
@@ -68,6 +68,23 @@ $(".confirm-flushlogs").confirm({
|
||||
dialogClass: "modal-dialog modal-mg"
|
||||
});
|
||||
|
||||
$(".api-token").confirm({
|
||||
text: "Make sure that nobody else can scan this code around you. They will have full access to the API without having to know the password. Note that the generation of the QR code will take some time.",
|
||||
title: "Confirmation required",
|
||||
confirm(button) {
|
||||
window.open("scripts/pi-hole/php/api_token.php");
|
||||
},
|
||||
cancel(button) {
|
||||
// nothing to do
|
||||
},
|
||||
confirmButton: "Yes, show API token",
|
||||
cancelButton: "No, go back",
|
||||
post: true,
|
||||
confirmButtonClass: "btn-danger",
|
||||
cancelButtonClass: "btn-success",
|
||||
dialogClass: "modal-dialog modal-mg"
|
||||
});
|
||||
|
||||
$("#DHCPchk").click(function() {
|
||||
$("input.DHCPgroup").prop("disabled", !this.checked);
|
||||
$("#dhcpnotice").prop("hidden", !this.checked).addClass("lookatme");
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<html><body>
|
||||
<?php
|
||||
require "auth.php";
|
||||
require "password.php";
|
||||
check_cors();
|
||||
|
||||
if($auth)
|
||||
{
|
||||
if(strlen($pwhash) > 0)
|
||||
{
|
||||
require_once("../../vendor/qrcode.php");
|
||||
$qr = QRCode::getMinimumQRCode($pwhash, QR_ERROR_CORRECT_LEVEL_Q);
|
||||
$qr->printHTML("10px");
|
||||
}
|
||||
else
|
||||
{
|
||||
?><p>No password set<?php
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
?><p>Not authorized!</p><?php
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
Vendored
+1543
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user