diff --git a/warpgate-admin/src/api/public_key_credentials.rs b/warpgate-admin/src/api/public_key_credentials.rs index ef093203..607521f9 100644 --- a/warpgate-admin/src/api/public_key_credentials.rs +++ b/warpgate-admin/src/api/public_key_credentials.rs @@ -158,6 +158,7 @@ impl DetailApi { let model = PublicKeyCredential::ActiveModel { id: Set(id.0), user_id: Set(*user_id), + openssh_public_key_title: Set(body.openssh_public_key_title.clone()), ..<_>::from(UserPublicKeyCredential::try_from(&*body)?) } .update(&*db) diff --git a/warpgate-web/src/admin/CredentialEditor.svelte b/warpgate-web/src/admin/CredentialEditor.svelte index 207d5016..fdfc8e36 100644 --- a/warpgate-web/src/admin/CredentialEditor.svelte +++ b/warpgate-web/src/admin/CredentialEditor.svelte @@ -185,9 +185,8 @@ } async function savePublicKeyCredential (opensshPublicKeyTitle: string, opensshPublicKey: string) { - // TODO: If it is an existing key, update it - // Otherwise, create a new one if (editingPublicKeyCredentialInstance) { + editingPublicKeyCredentialInstance.opensshPublicKeyTitle = opensshPublicKeyTitle editingPublicKeyCredentialInstance.opensshPublicKey = opensshPublicKey await api.updatePublicKeyCredential({ userId, diff --git a/warpgate-web/src/admin/PublicKeyCredentialModal.svelte b/warpgate-web/src/admin/PublicKeyCredentialModal.svelte index 78ac1f25..1a3c2eaf 100644 --- a/warpgate-web/src/admin/PublicKeyCredentialModal.svelte +++ b/warpgate-web/src/admin/PublicKeyCredentialModal.svelte @@ -4,7 +4,6 @@ Form, FormGroup, Input, - Label, Modal, ModalBody, ModalFooter, @@ -49,6 +48,7 @@ { if (instance) { + opensshPublicKeyTitle = instance.opensshPublicKeyTitle opensshPublicKey = instance.opensshPublicKey } field?.focus()