Skip to content

Commit

Permalink
fix(settings): Disable renaming for tokens marked to be wiped
Browse files Browse the repository at this point in the history
This otherwise a WipeException will be thrown when trying to rename

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed Dec 16, 2023
1 parent 9c44674 commit f275eb7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private function getAppTokens(): array {
return array_map(function (IToken $token) use ($sessionToken) {
$data = $token->jsonSerialize();
$data['canDelete'] = true;
$data['canRename'] = $token instanceof INamedToken;
$data['canRename'] = $token instanceof INamedToken && $data['type'] !== IToken::WIPE_TOKEN;

Check notice

Code scanning / Psalm

DeprecatedClass Note

Class OC\Authentication\Token\IToken is deprecated
if ($sessionToken->getId() === $token->getId()) {
$data['canDelete'] = false;
$data['canRename'] = false;
Expand Down
1 change: 1 addition & 0 deletions apps/settings/src/components/AuthTokenSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ export default {
console.debug('app token marked for wipe')

token.type = 2
token.canRename = false
} catch (err) {
console.error('could not wipe app token', err)
OC.Notification.showTemporary(t('settings', 'Error while wiping the device with the token'))
Expand Down

0 comments on commit f275eb7

Please sign in to comment.