fix(settings): confirm app-token revoke and preserve wipe state#60644
fix(settings): confirm app-token revoke and preserve wipe state#60644pringelmann wants to merge 4 commits into
Conversation
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>
| <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> |
There was a problem hiding this comment.
I think for consistent styling just use the components props
| <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 } { |
There was a problem hiding this comment.
What is "copy"?
A would prefer a more self explaining variable name here
| </NcDialog> | ||
| </template> | ||
|
|
||
| <script lang="ts"> |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
(also typing is much nicer and its less boiler plate code)
| </NcDialog> | ||
| </template> | ||
|
|
||
| <script lang="ts"> |
There was a problem hiding this comment.
similar here would be great to only add new vue files as script setup
susnux
left a comment
There was a problem hiding this comment.
functionality wise approved, some code comments
| :open="wipeDialogOpen" | ||
| @update:open="wipeDialogOpen = $event" |
There was a problem hiding this comment.
| :open="wipeDialogOpen" | |
| @update:open="wipeDialogOpen = $event" | |
| :open.sync="wipeDialogOpen" |
| :open="deleteDialogOpen" | ||
| @update:open="deleteDialogOpen = $event" |
There was a problem hiding this comment.
| :open="deleteDialogOpen" | |
| @update:open="deleteDialogOpen = $event" | |
| :open.sync="deleteDialogOpen" |
|
|
||
| wipe() { | ||
| this.actionOpen = false | ||
| this.wipeDialogOpen = true |
There was a problem hiding this comment.
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
Summary
Revoking an app password now opens an
NcDialogconfirmation. 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:deleterefuses wipe-pending tokens unless--cancel-wipeis 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
Checklist
3. to review, feature component)stable32)