Skip to content

fix(settings): confirm app-token revoke and preserve wipe state#60644

Open
pringelmann wants to merge 4 commits into
masterfrom
fix/app-token-delete-confirm
Open

fix(settings): confirm app-token revoke and preserve wipe state#60644
pringelmann wants to merge 4 commits into
masterfrom
fix/app-token-delete-confirm

Conversation

@pringelmann
Copy link
Copy Markdown
Contributor

@pringelmann pringelmann commented May 21, 2026

Summary

Revoking an app password now opens an NcDialog confirmation. For tokens marked for remote wipe the dialog uses a red error card and the destructive button reads "Revoke and cancel wipe", so cancelling an in-flight wipe is a deliberate click rather than a side effect of clicking the trash icon.

Two admin-only deletion paths used to drop the wipe marker the same way the user-facing controller did. Both are guarded now: occ user:auth-tokens:delete refuses wipe-pending tokens unless --cancel-wipe is passed, and OAuth2 client revocation skips matching wipe-pending tokens (with a log line) so the wipe outlives the client.

Backports needed for stable33, stable32, stable31.

Screenshot

Screenshot_2026-05-21_17-02-03

Checklist

  • Code is properly formatted
  • Sign-off message is added to all commits
  • Tests (unit, integration, api and/or acceptance) are included
  • Screenshots before/after for front-end changes
  • Documentation (manuals or wiki) has been updated or is not required
  • Backports requested where applicable (ex: critical bugfixes)
  • Labels added where applicable (ex: bug/enhancement, 3. to review, feature component)
  • Milestone added for target branch/version (ex: 32.x for stable32)

Adds an NcDialog confirmation to the Revoke action; deletion was
previously instant on click. When the token is marked for remote
wipe, the dialog surfaces a warning and the destructive button
switches to "Cancel wipe and revoke" so cancelling an in-flight
wipe is an explicit opt-in.

Also migrates the existing Wipe confirm from the legacy
window.OC.dialogs.confirm helper to NcDialog, matching the new
delete dialog. The auth token store actions are now pure API
callers; the UI does the gating.

Signed-off-by: Peter Ringelmann <peter.ringelmann@nextcloud.com>
Signed-off-by: Peter Ringelmann <peter.ringelmann@nextcloud.com>
Signed-off-by: Peter Ringelmann <peter.ringelmann@nextcloud.com>
Signed-off-by: Peter Ringelmann <peter.ringelmann@nextcloud.com>
@pringelmann pringelmann added this to the Nextcloud 34 milestone May 21, 2026
@pringelmann pringelmann self-assigned this May 21, 2026
@pringelmann pringelmann marked this pull request as ready for review May 22, 2026 09:17
@pringelmann pringelmann requested review from a team as code owners May 22, 2026 09:17
@pringelmann pringelmann requested review from come-nc, nfebe, provokateurin, sorbaugh and susnux and removed request for a team May 22, 2026 09:17
Comment on lines +13 to +20
<NcNoteCard v-if="wiping" type="error">
<p class="auth-token-delete-dialog__warning-headline">
<strong>{{ t('settings', 'Remote wipe has not started yet.') }}</strong>
</p>
<p>
{{ t('settings', 'Revoking now cancels the wipe. The device keeps its synced data.') }}
</p>
</NcNoteCard>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for consistent styling just use the components props

Suggested change
<NcNoteCard v-if="wiping" type="error">
<p class="auth-token-delete-dialog__warning-headline">
<strong>{{ t('settings', 'Remote wipe has not started yet.') }}</strong>
</p>
<p>
{{ t('settings', 'Revoking now cancels the wipe. The device keeps its synced data.') }}
</p>
</NcNoteCard>
<NcNoteCard
v-if="wiping"
:heading="t('settings', 'Remote wipe has not started yet.')"
type="error">
{{ t('settings', 'Revoking now cancels the wipe. The device keeps its synced data.') }}
</NcNoteCard>

return this.token.type === TokenType.WIPING_TOKEN
},

copy(): { title: string, body: string, action: string } {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is "copy"?

A would prefer a more self explaining variable name here

</NcDialog>
</template>

<script lang="ts">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be great to always use script setup for all new files so we do not have to do migration work in the future when we want to support vapor mode

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(also typing is much nicer and its less boiler plate code)

</NcDialog>
</template>

<script lang="ts">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar here would be great to only add new vue files as script setup

Copy link
Copy Markdown
Contributor

@susnux susnux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

functionality wise approved, some code comments

Comment on lines +94 to +95
:open="wipeDialogOpen"
@update:open="wipeDialogOpen = $event"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:open="wipeDialogOpen"
@update:open="wipeDialogOpen = $event"
:open.sync="wipeDialogOpen"

Comment on lines +88 to +89
:open="deleteDialogOpen"
@update:open="deleteDialogOpen = $event"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:open="deleteDialogOpen"
@update:open="deleteDialogOpen = $event"
:open.sync="deleteDialogOpen"


wipe() {
this.actionOpen = false
this.wipeDialogOpen = true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory this dialog component could be replaced with just a call to showConfirmation
https://nextcloud-libraries.github.io/nextcloud-dialogs/functions/showConfirmation.html

But both is fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews enhancement feature: settings team: IDP Code maintained by 🪪 IDP team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants