Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TOTP Code Copy Functionality in Device List #495

Closed
wants to merge 5 commits into from

Conversation

mentatbot[bot]
Copy link

@mentatbot mentatbot bot commented Jul 10, 2024

This commit addresses issue #493 by adding the ability to copy TOTP codes from the device list in the vault. The following changes were made:

  • Introduced a new state variable TOTPCode in DeviceListItem to store the TOTP code.
  • Added a handleCopyTOTP function to copy the TOTP code to the clipboard.
  • Included a "Copy TOTP" button in the device list item UI, which appears if a TOTP code is available.
  • Passed the TOTPCode prop to DeviceListItem from the parent Devices component.

Closes #493

This commit addresses issue #493 by adding the ability to copy TOTP codes from the device list in the vault. The following changes were made:
- Introduced a new state variable `TOTPCode` in `DeviceListItem` to store the TOTP code.
- Added a `handleCopyTOTP` function to copy the TOTP code to the clipboard.
- Included a "Copy TOTP" button in the device list item UI, which appears if a TOTP code is available.
- Passed the `TOTPCode` prop to `DeviceListItem` from the parent `Devices` component.
@mentatbot mentatbot bot requested a review from capaj July 10, 2024 14:45
MentatBot added 2 commits July 10, 2024 14:48
This commit addresses the JSX syntax errors that caused the CI failure. The following changes were made:
- Corrected the JSX structure to ensure all elements have corresponding closing tags.
- Fixed misplaced and missing parentheses.
- Ensured that JSX expressions have a single parent element.

These changes should resolve the TypeScript compilation errors and allow the CI to pass successfully.
This commit addresses the CI failure caused by TypeScript errors in the `Devices.tsx` file. The following changes were made:

1. Updated the `DeviceQuery` type to include the optional `TOTPCode` field.
2. Modified the `DeviceListItem` component to handle the `TOTPCode` field as optional.
3. Corrected the duplicate identifier issue by ensuring `TOTPCode` is only defined once in the component's state.

These changes should resolve the TypeScript errors and allow the CI pipeline to pass successfully.
@capaj
Copy link
Collaborator

capaj commented Jul 10, 2024

Oh I made a mistake in my description.
You actually need to change it in another file here:

// TODO implement this see issue #493

Copy link
Author

@mentatbot mentatbot bot left a comment

Choose a reason for hiding this comment

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

Thanks for pointing that out, I'll update the necessary file and push the changes shortly.

Oh I made a mistake in my description.
You actually need to change it in another file here:

// TODO implement this see issue #493

I'll make the necessary changes to the VirtualizedList.tsx as suggested.

Thanks for using MentatBot. Reply with feedback or to ask MentatBot to review other parts of the PR. Please give feedback with emoji reacts.

MentatBot added 2 commits July 10, 2024 15:10
This commit addresses issue #493 by adding the ability to copy TOTP codes from the VaultListItem component. The following changes were made:
- Introduced a new state variable `TOTPCode` in `VaultListItem` to store the TOTP code.
- Added a `handleCopyTOTP` function to copy the TOTP code to the clipboard and show a success toast.
- Included a "Copy TOTP" button in the VaultListItem UI, which appears if a TOTP code is available.

Closes #493
This commit addresses the CI failures by ensuring the TOTPCode property is correctly handled in the codebase. The following changes were made:

1. Updated `VirtualizedList.tsx` to properly check the type of `secret` before accessing `TOTPCode`.
2. Corrected the type check for `EncryptedSecretType.TOTP_SECRET` to `EncryptedSecretType.TOTP`.
3. Modified `Devices.tsx` to handle `TOTPCode` using nullish coalescing to avoid undefined values.
4. Added a conditional check in `handleCopyTOTP` to ensure `TOTPCode` is not null before attempting to copy it to the clipboard.

These changes should resolve the TypeScript errors and ensure the code runs successfully in the CI pipeline.
Copy link
Author

mentatbot bot commented Jul 10, 2024

You are out of MentatBot commits; MentatBot will not iterate on CI failure. Your usage will refresh July 15 at 07:00 AM.

@capaj
Copy link
Collaborator

capaj commented Jul 10, 2024

this was badly described. Will try to describe it better next time

@capaj capaj closed this Jul 10, 2024
Copy link
Author

mentatbot bot commented Jul 10, 2024

You are out of MentatBot commits. Your usage will refresh July 15 at 07:00 AM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TOTP code cannot be copied from VaultListItem component
1 participant