Hide api key by default and add qrcode

This commit is contained in:
osaajani 2022-01-20 02:51:41 +01:00
parent bd3da73711
commit 85fb487d84
3 changed files with 35 additions and 2 deletions

1
assets/js/qrcode.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -42,7 +42,18 @@
<div class="panel-body">
<strong>Adresse e-mail :</strong> <?php $this->s($_SESSION['user']['email']); ?><br/>
<strong>Niveau administrateur :</strong> <?php echo $_SESSION['user']['admin'] ? 'Oui' : 'Non'; ?><br/>
<strong>Clef API :</strong> <?php echo $_SESSION['user']['api_key']; ?><br/>
<br/>
<div id="api-key-container" class="">
<strong>Clef API :</strong>
<span id="show-api-key-link" class="visible">
<a href="#">Cliquez pour afficher la clef API.</a><br/>
</span>
<span id="api-key" class="hidden">
<?php echo $_SESSION['user']['api_key']; ?><br/>
<div style="margin-top: 15px" id="api-key-qrcode"></div>
</span>
</div>
</div>
</div>
<div class="panel panel-default">
@ -146,6 +157,25 @@
});
window.location = url;
});
jQuery('#show-api-key-link').on('click', function (e)
{
e.preventDefault();
jQuery(this).toggleClass('visible').toggleClass('hidden');
jQuery('#api-key').toggleClass('visible').toggleClass('hidden');
});
var qrcode = new QRCode("api-key-qrcode", {
text: <?= json_encode($_SESSION['user']['api_key']); ?>,
width: 128,
height: 128,
colorDark : "#000000",
colorLight : "#ffffff",
correctLevel : QRCode.CorrectLevel.H
});
jQuery('')
});
</script>
<?php

View File

@ -40,7 +40,9 @@
<!-- DataTables -->
<link href="<?php echo HTTP_PWD_CSS; ?>/datatables/datatables.min.css" rel="stylesheet" type="text/css">
<script src="<?php echo HTTP_PWD_JS; ?>/datatables/datatables.min.js"></script>
<!-- Qrcode lib -->
<script src="<?php echo HTTP_PWD_JS; ?>/qrcode.min.js"></script>
<!-- Custom JS -->
<script src="<?php echo HTTP_PWD_JS; ?>/custom.js"></script>