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

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion Xcodes/Frontend/SignIn/PinCodeTextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,15 @@ class PinCodeTextView: NSControl, NSTextFieldDelegate {
else { return }

let newFieldText = field.stringValue


// 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.

code = Array(newFieldText)
window?.makeFirstResponder(characterViews.last)
return
}

let lastCharacter: Character?
if newFieldText.isEmpty {
lastCharacter = nil
Expand Down