From 7a88e81dc17bdbeb6683be70d4c96cfc1d95eec7 Mon Sep 17 00:00:00 2001 From: Futa Ikeda Date: Wed, 6 Nov 2024 10:30:05 -0500 Subject: [PATCH] Remove new unauthorized accounts --- .../addon-account-setup/component.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/osf-components/addon/components/addons-service/addon-account-setup/component.ts b/lib/osf-components/addon/components/addons-service/addon-account-setup/component.ts index a96b90f3dbb..caeafc663a5 100644 --- a/lib/osf-components/addon/components/addons-service/addon-account-setup/component.ts +++ b/lib/osf-components/addon/components/addons-service/addon-account-setup/component.ts @@ -132,20 +132,20 @@ export default class AddonAccountSetupComponent extends Component { return [ { name: 'access_token', - labelText: t('addons.accountCreate.api-token-label') , + labelText: t('addons.accountCreate.api-token-label'), inputType: 'text', - inputPlaceholder: t('addons.accountCreate.api-token-placeholder'), + inputPlaceholder: t('addons.accountCreate.api-token-placeholder'), inputValue: credentials.access_token, }, ]; } - case CredentialsFormat.DATAVERSE_API_TOKEN:{ + case CredentialsFormat.DATAVERSE_API_TOKEN: { return [ { name: 'access_token', labelText: t('addons.accountCreate.personal-access-token-label'), inputType: 'text', - inputPlaceholder: t('addons.accountCreate.personal-access-token-placeholder'), + inputPlaceholder: t('addons.accountCreate.personal-access-token-placeholder'), inputValue: credentials.access_token, }, ]; @@ -283,4 +283,11 @@ export default class AddonAccountSetupComponent extends Component { } } } + + willDestroy() { + if (!this.args.account && this.newAccount && !this.newAccount.credentialsAvailable) { + this.newAccount.deleteRecord(); + this.newAccount.save(); + } + } }