Skip to content

Conversation

@zhangqifan
Copy link

Description

Improves the paste functionality for PIN code input fields used in SMS and 2FA authentication flows.

Problem

When pasting a 6-digit verification code like "123456" into the PIN code input fields, only the last digit ("6") would appear in the first field. The other digits were lost.

Solution

  • Add detection for multi-character paste operations
  • Filter pasted content to alphanumeric characters only
  • Always start filling from the first field when pasting
  • Optimize performance by updating all fields at once
  • Support both numeric and alphanumeric codes (e.g., 123456, A1B2C3)

Impact

This improvement benefits both:

  • SignInSMSView - SMS verification code input
  • SignIn2FAView - 2FA device verification code input

Both views share the same PinCodeTextField component, so the fix applies automatically to both flows.

Testing

Tested with:

  • ✅ Pasting 6-digit numeric codes (123456)
  • ✅ Pasting with cursor in different positions (always fills from first field)
  • ✅ Pasting codes with special characters (auto-filtered to alphanumeric only)
  • ✅ Manual single-character input (unchanged behavior)

Checklist

  • Code follows the project's style guidelines
  • Self-review of code completed
  • No new warnings or errors introduced
  • Changes tested with real authentication flow

- Add support for pasting multi-digit verification codes
- Filter pasted content to alphanumeric characters only
- Always start filling from the first field when pasting
- Optimize performance by updating all fields at once
- Support both numeric and alphanumeric codes (e.g., 123456, A1B2C3)

Fixes the issue where pasting a 6-digit code like '123456' would only
show the last digit '6' in the first field. Now all digits are correctly
distributed across all input fields.

This improvement benefits both SignInSMSView and SignIn2FAView since they
share the same PinCodeTextField component.
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.

1 participant