diff --git a/renderer.py b/renderer.py index 9d53ba4..aca3fa2 100644 --- a/renderer.py +++ b/renderer.py @@ -466,7 +466,7 @@ def build_preauth_key_table(user_name): ID - Key + Key Prefix
Reusable
Used
Ephemeral
@@ -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+""" - """+str(key["id"])+""" + """+str(key["id"])[0:10]+""" onclick=copy_preauth_key(""""+str(key["id"])+"""") """+str(key["key"])+"""
"""+btn_reusable+"""
"""+btn_used+"""
diff --git a/static/js/custom.js b/static/js/custom.js index 3270086..1fb841e 100644 --- a/static/js/custom.js +++ b/static/js/custom.js @@ -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.'}) +}