XcodesApp icon indicating copy to clipboard operation
XcodesApp copied to clipboard

fix: improve paste support for PIN code input fields

Open zhangqifan opened this issue 1 month ago • 0 comments

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

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

zhangqifan avatar Nov 12 '25 07:11 zhangqifan