From 45ebb0b1f93e2673ec8a4c9efc4645ff56e71bf4 Mon Sep 17 00:00:00 2001 From: Mariell Hoversholm Date: Thu, 13 Feb 2025 14:13:48 +0100 Subject: [PATCH] Provisioning: Retain old token in config (#100597) fix: retain old token in config --- public/app/features/provisioning/ConfigForm.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/public/app/features/provisioning/ConfigForm.tsx b/public/app/features/provisioning/ConfigForm.tsx index feee5b851aa..0808dc5c090 100644 --- a/public/app/features/provisioning/ConfigForm.tsx +++ b/public/app/features/provisioning/ConfigForm.tsx @@ -94,8 +94,13 @@ export function ConfigForm({ data }: ConfigFormProps) { } }, [request.isSuccess, reset, getValues, navigate]); - const onSubmit = (data: RepositoryFormData) => { - const spec = dataToSpec(data); + const onSubmit = (form: RepositoryFormData) => { + const spec = dataToSpec(form); + if (spec.github) { + spec.github.token = form.token || data?.spec?.github?.token; + // If we're still keeping this as GitHub, persist the old token. If we set a new one, it'll be re-encrypted into here. + spec.github.encryptedToken = data?.spec?.github?.encryptedToken; + } submitData(spec); };