Add copy password button

This commit is contained in:
Taylor Helsper 2021-10-21 23:45:19 -05:00
parent 2ce9c814fe
commit 72cc7ab502
2 changed files with 17 additions and 1 deletions

View File

@ -42,4 +42,10 @@ function openConfirmDialog(divid, title, message, okFunction) {
}
}
});
}
// Show alert popup with contents
function showAlertPopup(divid, message) {
$("#"+divid).html(message);
$("#"+divid).show().delay(3000).fadeOut();
}

View File

@ -96,6 +96,13 @@
$("#show_lit_password").hide(0);
$("#lit_password").show();
});
$("#copy_lit_password").on("click", function() {
navigator.clipboard.writeText("{{lit_password}}").then(function() {
showAlertPopup("alert_popup", "<b>Password copied!</b>");
}, function() {
showAlertPopup("alert_popup", "<b>Password copy failed!</b>");
});
});
$('#watchtower_enabled_checkbox').change(function () {
$("#watchtower_enabled_save").show();
@ -239,7 +246,8 @@
<th>Lightning Terminal</th>
<td>
<a class="ui-button ui-widget ui-corner-all mynode_button_small" id="lit" style="width: 100px;" href="#">open</a>
<span id="lit_password" style="display: none; margin: 0;">{{lit_password}}</span>
<span id="lit_password" style="display: none; margin: 0;">{{lit_password}} <span id="copy_lit_password" class="ui-icon ui-icon-copy" style="cursor: pointer;" title="Copy Password"></span></span>
<a id="show_lit_password" class="ui-button ui-widget ui-corner-all mynode_button_small" style="width: 100px;">show password</a>
</td>
</tr>
@ -648,6 +656,8 @@
</form>
</div>
<div id="alert_popup" class="bottom_center_alert_popup"></div>
{% include 'includes/footer.html' %}
</body>
</html>