mirror of
https://github.com/iFargle/headscale-webui.git
synced 2026-03-16 08:55:39 +01:00
Fix preauth-key expire logic and error messages
This commit is contained in:
12
renderer.py
12
renderer.py
@@ -493,14 +493,14 @@ def build_preauth_key_table(user_name):
|
||||
|
||||
tooltip_expired = "Expiration: "+expiration_time
|
||||
|
||||
btn_reusable = "<i class='pulse material-icons tiny blue-text text-darken-1'>fiber_manual_record</i>" if key["reusable"] else ""
|
||||
btn_ephemeral = "<i class='pulse material-icons tiny red-text text-darken-1'>fiber_manual_record</i>" if key["ephemeral"] else ""
|
||||
btn_used = "<i class='pulse material-icons tiny yellow-text text-darken-1'>fiber_manual_record</i>" if key["used"] else ""
|
||||
btn_usable = "<i class='pulse material-icons tiny green-text text-darken-1'>fiber_manual_record</i>" if key_usable else ""
|
||||
btn_reusable = "<i class='pulse material-icons tiny blue-text text-darken-1'>fiber_manual_record</i>" if key["reusable"] else ""
|
||||
btn_ephemeral = "<i class='pulse material-icons tiny red-text text-darken-1'>fiber_manual_record</i>" if key["ephemeral"] else ""
|
||||
btn_used = "<i class='pulse material-icons tiny yellow-text text-darken-1'>fiber_manual_record</i>" if key["used"] else ""
|
||||
btn_usable = "<i class='pulse material-icons tiny green-text text-darken-1'>fiber_manual_record</i>" if key_usable else ""
|
||||
|
||||
# Other buttons:
|
||||
btn_delete = "<span href='#card_modal' data-tooltip='Expire this PreAuth Key' class='btn-small modal-trigger badge tooltipped white-text red' onclick='load_modal_expire_preauth_key(\""+user_name+"\", \""+str(key["key"])+"\")'>Expire</span>" if not key_expired else ""
|
||||
tooltip_data = "Expiration: "+expiration_time
|
||||
btn_delete = "<span href='#card_modal' data-tooltip='Expire this PreAuth Key' class='btn-small modal-trigger badge tooltipped white-text red' onclick='load_modal_expire_preauth_key(\""+user_name+"\", \""+str(key["key"])+"\")'>Expire</span>" if key_usable else ""
|
||||
tooltip_data = "Expiration: "+expiration_time
|
||||
|
||||
# TR ID will look like "1-albert-tr"
|
||||
preauth_keys_collection = preauth_keys_collection+"""
|
||||
|
||||
@@ -921,7 +921,7 @@ function expire_preauth_key(user_name, key) {
|
||||
success: function(response) {
|
||||
if (response.status == "True") {
|
||||
// Send the completion toast
|
||||
M.toast({html: 'PreAuth key created in user '+user_name})
|
||||
M.toast({html: 'PreAuth expired in '+user_name})
|
||||
// If this is successfull, we should reload the table and close the modal:
|
||||
var user_data = {"name": user_name}
|
||||
$.ajax({
|
||||
@@ -944,7 +944,7 @@ function expire_preauth_key(user_name, key) {
|
||||
M.Tooltip.init(document.querySelectorAll('.tooltipped'))
|
||||
|
||||
} else {
|
||||
load_modal_generic("error", "Error adding a pre-auth key", "Headscale response: "+JSON.stringify(response.body.message))
|
||||
load_modal_generic("error", "Error expiring a pre-auth key", "Headscale response: "+JSON.stringify(response.body.message))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user