From 16ca990bdb36048f9c4c318b96ad49a32e519e87 Mon Sep 17 00:00:00 2001 From: Peter Ringelmann Date: Wed, 20 May 2026 19:06:00 +0200 Subject: [PATCH] fix(settings): confirm before revoking app tokens Signed-off-by: Peter Ringelmann --- .../settings/src/components/AuthToken.spec.ts | 4 +-- .../src/components/AuthTokenDeleteDialog.vue | 33 +++++++++++-------- .../src/components/AuthTokenWipeDialog.vue | 24 +++----------- 3 files changed, 27 insertions(+), 34 deletions(-) diff --git a/apps/settings/src/components/AuthToken.spec.ts b/apps/settings/src/components/AuthToken.spec.ts index c83155eb9a3..fb3c0c06453 100644 --- a/apps/settings/src/components/AuthToken.spec.ts +++ b/apps/settings/src/components/AuthToken.spec.ts @@ -181,13 +181,13 @@ describe('AuthTokenDeleteDialog wipe-pending warning', () => { expect(wrapper.findComponent(NcNoteCard).exists()).toBe(false) }) - it('renders an accessible warning NcNoteCard for a wipe-pending token', () => { + it('renders an accessible error NcNoteCard for a wipe-pending token', () => { const token = makeToken({ type: TokenType.WIPING_TOKEN }) const wrapper = mountDeleteDialog(token) const noteCard = wrapper.findComponent(NcNoteCard) expect(noteCard.exists()).toBe(true) - expect(noteCard.props('type')).toBe('warning') + expect(noteCard.props('type')).toBe('error') expect(noteCard.text()).toMatch(/wipe/i) }) }) diff --git a/apps/settings/src/components/AuthTokenDeleteDialog.vue b/apps/settings/src/components/AuthTokenDeleteDialog.vue index 71db7193646..daf8f5de1dc 100644 --- a/apps/settings/src/components/AuthTokenDeleteDialog.vue +++ b/apps/settings/src/components/AuthTokenDeleteDialog.vue @@ -10,9 +10,12 @@ :buttons="buttons" size="normal" @update:open="onUpdateOpen"> - + +

+ {{ t('settings', 'Remote wipe has not started yet.') }} +

- {{ t('settings', 'The remote wipe for this device has not finished yet. Revoking the app password now will cancel the pending wipe and the device will keep its access to previously synced data.') }} + {{ t('settings', 'Revoking now cancels the wipe. The device keeps its synced data.') }}

@@ -64,20 +67,19 @@ export default defineComponent({ dialogTitle(): string { return this.wiping - ? t('settings', 'Cancel pending remote wipe and revoke app password?') + ? t('settings', 'Revoke and cancel pending wipe?') : t('settings', 'Revoke app password?') }, bodyText(): string { - if (this.wiping) { - return t('settings', 'Continuing will cancel the pending remote wipe and permanently revoke this app password. The device will retain any data it has already synced.') - } - return t('settings', 'This will permanently revoke the app password. The connected app or device will lose access on its next sync.') + return this.wiping + ? t('settings', 'Only continue if you no longer need the device to be wiped.') + : t('settings', 'The app or device will lose access on its next sync. This cannot be undone.') }, destructiveLabel(): string { return this.wiping - ? t('settings', 'Cancel wipe and revoke') + ? t('settings', 'Revoke and cancel wipe') : t('settings', 'Revoke') }, @@ -85,15 +87,14 @@ export default defineComponent({ return [ { label: t('settings', 'Cancel'), - // @ts-expect-error 'value' is missing from upstream types - type: 'tertiary', + variant: 'tertiary', callback: () => { this.$emit('update:open', false) }, }, { label: this.destructiveLabel, - type: 'error', + variant: 'error', callback: () => { this.$emit('confirm') this.$emit('update:open', false) @@ -113,7 +114,13 @@ export default defineComponent({ diff --git a/apps/settings/src/components/AuthTokenWipeDialog.vue b/apps/settings/src/components/AuthTokenWipeDialog.vue index 6182a0de8ac..39f60bf9999 100644 --- a/apps/settings/src/components/AuthTokenWipeDialog.vue +++ b/apps/settings/src/components/AuthTokenWipeDialog.vue @@ -6,17 +6,12 @@ @@ -29,14 +24,12 @@ import type { IToken } from '../store/authtoken.ts' import { translate as t } from '@nextcloud/l10n' import { defineComponent } from 'vue' import NcDialog from '@nextcloud/vue/components/NcDialog' -import NcNoteCard from '@nextcloud/vue/components/NcNoteCard' export default defineComponent({ name: 'AuthTokenWipeDialog', components: { NcDialog, - NcNoteCard, }, props: { @@ -61,15 +54,14 @@ export default defineComponent({ return [ { label: t('settings', 'Cancel'), - // @ts-expect-error 'value' is missing from upstream types - type: 'tertiary', + variant: 'tertiary', callback: () => { this.$emit('update:open', false) }, }, { label: t('settings', 'Wipe device'), - type: 'error', + variant: 'error', callback: () => { this.$emit('confirm') this.$emit('update:open', false) @@ -87,9 +79,3 @@ export default defineComponent({ }, }) - -