Copy PreauthKey to keyboard. Added initial formatting

This commit is contained in:
iFargle
2023-02-10 14:01:31 +09:00
parent e22b9fd6f0
commit 66196d0001
2 changed files with 9 additions and 2 deletions

View File

@@ -466,7 +466,7 @@ def build_preauth_key_table(user_name):
<thead>
<tr>
<td>ID</td>
<td>Key</td>
<td class='tooltipped' data-tooltip='Click an Auth Key Prefix to copy it to the clipboard'>Key Prefix</td>
<td><center>Reusable</center></td>
<td><center>Used</center></td>
<td><center>Ephemeral</center></td>
@@ -505,7 +505,7 @@ def build_preauth_key_table(user_name):
# TR ID will look like "1-albert-tr"
preauth_keys_collection = preauth_keys_collection+"""
<tr id='"""+key["id"]+"""-"""+user_name+"""-tr' class='"""+hide_expired+"""'>
<td>"""+str(key["id"])+"""</td>
<td>"""+str(key["id"])[0:10]+""" onclick=copy_preauth_key(""""+str(key["id"])+"""")</td>
<td class='tooltipped' data-tooltip='"""+tooltip_data+"""'>"""+str(key["key"])+"""</td>
<td><center>"""+btn_reusable+"""</center></td>
<td><center>"""+btn_used+"""</center></td>

View File

@@ -968,3 +968,10 @@ function toggle_expired() {
}
}
}
// Copy a PreAuth Key to the clipboard. Show only the Prefix by default
function copy_preauth_key(key) {
key.select();
navigator.clipboard.writeText(key);
M.toast({html: 'PreAuth key copied to clipboard.'})
}