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

Add support for pasting the entire 2FA code #225

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alexisakers
Copy link

Goals

This PR adds support for pasting the entire 2FA code if the new string equals the length of the expected 2FA code. Currently, when pasting the 2FA code, only the last digit gets pasted.

Notes

I think it makes sense to have this behavior only if the user didn't enter any digit so that we can avoid any weird edge cases that could override their input, but let me know if you disagree.

Demo

Screen.Recording.2022-05-17.at.10.18.02.AM.mov

@alexisakers alexisakers requested a review from a team as a code owner May 17, 2022 14:25
Copy link
Contributor

@MattKiazyk MattKiazyk left a comment

Choose a reason for hiding this comment

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

Thanks @alexisakers!

This really shows that MacOS needs a way to copy/paste the Trusted Device 2FA code!

Looks and works great - just one small #picky change.


// If we are focused on the first field and pasting a 6-digit string,
// treat it as pasting the entire code and focus on the last field
if code.isEmpty && newFieldText.count == numberOfDigits {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can remove the isEmpty check and just add a check to make sure you are on the first character field instead. That way, as long as you're on the first field, you can paste the 6 digits.

@MattKiazyk MattKiazyk added the enhancement New feature or request label May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants