1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2025-04-03 00:07:05 +00:00

feat(rsync-backup-ui): Add a Copy button to put public key on clipboard

This commit is contained in:
Hugh Secker-Walker 2023-01-25 21:50:27 +00:00
parent 5e3e4a2161
commit f5e4cb91ca

View File

@ -73,6 +73,9 @@
passwordless authentication from your mail-in-a-box server and your backup server.
</div>
</div>
<div id="copy_pub_key_div" class="col-sm">
<button type="button" class="btn btn-small" onclick="copy_pub_key_to_clipboard()">Copy</button>
</div>
</div>
<!-- S3 BACKUP -->
<div class="form-group backup-target-s3">
@ -374,4 +377,14 @@ const url_split = url => {
}
};
// hide Copy button if not in a modern clipboard-supporting environment
if (!(navigator && navigator.clipboard && navigator.clipboard.writeText)) {
document.getElementById('copy_pub_key_div').hidden = true;
}
function copy_pub_key_to_clipboard() {
const ssh_pub_key = $("#ssh-pub-key").val();
navigator.clipboard.writeText(ssh_pub_key);
}
</script>