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

Improve one time password #594

Merged
merged 6 commits into from
Feb 6, 2024
Merged

Improve one time password #594

merged 6 commits into from
Feb 6, 2024

Conversation

DeeTheDev
Copy link
Collaborator

Fixes #592

Pasting code from IOS devices Keyboard pasting did not trigger the paste event, instead, it triggers the onChange event. Solution is to handle pasting through onChange similar to the handleOtpPaste function. Follow changes happened due to this solution:

  • Since we have to handle 6 pasted characters in each of the 6 inputs, we set the maxLength property to 6
  • Multiple characters are allowed, so we check that there are no non-digit characters, otherwise we return
  • Replaced onChange event to onInput to allow immediate after the value of an element has changed; ref
  • handle when an input selection carat is to the left by fetching the 0 index of the value, otherwise fetch the last index of value

Handle character deletion

  • Set condition to catch when "Backspace" and "Delete" keys are triggered
  • Remove current value and focus the previous input element

@DeeTheDev DeeTheDev added bug Something isn't working webapp Public frontend changes labels Feb 1, 2024
@DeeTheDev DeeTheDev requested a review from rgalanakis February 1, 2024 17:53
@DeeTheDev DeeTheDev self-assigned this Feb 1, 2024
@rgalanakis rgalanakis merged commit 35a2008 into main Feb 6, 2024
3 checks passed
@rgalanakis rgalanakis deleted the improve-one-time-password branch February 6, 2024 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working webapp Public frontend changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve One-Time-Password field
2 participants