Add gen_apikey to template

This commit is contained in:
billz 2024-03-08 10:45:05 +01:00
parent 95ad90063b
commit 282b839f45
3 changed files with 14 additions and 5 deletions

View file

@ -122,6 +122,10 @@ $(document).on("click", "#gen_wpa_passphrase", function(e) {
$('#txtwpapassphrase').val(genPassword(63));
});
$(document).on("click", "#gen_apikey", function(e) {
$('#txtapikey').val(genPassword(32).toLowerCase());
});
$(document).on("click", "#js-clearhostapd-log", function(e) {
var csrfToken = $('meta[name=csrf_token]').attr('content');
$.post('ajax/logging/clearlog.php?',{'logfile':'/tmp/hostapd.log', 'csrf_token': csrfToken},function(data){

View file

@ -2,9 +2,9 @@
<?php if (!RASPI_MONITOR_ENABLED) : ?>
<input type="submit" class="btn btn-outline btn-primary" name="SaveAPIsettings" value="<?php echo _("Save settings"); ?>" />
<?php if ($serviceStatus == 'down') : ?>
<input type="submit" <?php echo $svcState; ?> class="btn btn-success <?php echo $svcState; ?>" name="StartRestAPIservice" value="<?php echo _("Start RestAPI service"); ?>" />
<input type="submit" class="btn btn-success" name="StartRestAPIservice" value="<?php echo _("Start RestAPI service"); ?>" />
<?php else : ?>
<input type="submit" <?php echo $ctlState; ?> class="btn btn-warning <?php echo $svcState; ?>" name="StopRestAPIservice" value="<?php echo _("Stop RestAPI service"); ?>" />
<input type="submit" class="btn btn-warning" name="StopRestAPIservice" value="<?php echo _("Stop RestAPI service"); ?>" />
<?php endif; ?>
<?php endif ?>
<?php $buttons = ob_get_clean(); ob_end_clean() ?>

View file

@ -5,9 +5,14 @@
<div class="row">
<div class="form-group col-md-6" required>
<label for="txtapikey"><?php echo _("API Key"); ?></label>
<input type="text" id="txtapikey" class="form-control" name="txtapikey" value="<?php echo htmlspecialchars($apiKey, ENT_QUOTES); ?>" required />
<div class="invalid-feedback">
<?php echo _("Please provide a valid API key."); ?>
<div class="input-group">
<input type="text" class="form-control" id="txtapikey" name="txtapikey" value="<?php echo htmlspecialchars($apiKey, ENT_QUOTES); ?>" required />
<div class="input-group-append">
<button class="btn btn-outline-secondary" type="button" id="gen_apikey"><i class="fas fa-magic"></i></button>
</div>
<div class="invalid-feedback">
<?php echo _("Please provide a valid API key."); ?>
</div>
</div>
</div>
</div>