Skip to content

feat: Add OTP resend timer functionality to ConfirmCode - [CU-869bgc23c] - #242

Merged
Exo1i merged 5 commits into
devfrom
feat/reset-password-timer
Dec 15, 2025
Merged

feat: Add OTP resend timer functionality to ConfirmCode - [CU-869bgc23c]#242
Exo1i merged 5 commits into
devfrom
feat/reset-password-timer

Conversation

@Exo1i

@Exo1i Exo1i commented Dec 15, 2025

Copy link
Copy Markdown
Member

This pull request enhances the ConfirmCode password reset flow by introducing and testing a resend code timer. The timer prevents users from immediately requesting a new code, ensuring a 60-second delay between resend attempts. The changes include both updates to the component logic and comprehensive tests to verify timer behavior and edge cases.

Timer and resend logic improvements:

  • Added a countdown timer (resendTimer) to the ConfirmCode component, which starts at 60 seconds on screen load and after a successful resend, preventing the resend button from being used until the timer expires. The timer is managed using a useEffect hook and cleared appropriately. [1] [2] [3] [4]
  • Updated the resend button logic to be disabled while the timer is active or a resend is in progress, and to reset the timer only on successful resend attempts. [1] [2]

Test suite enhancements:

  • Refactored and expanded tests for ConfirmCode to cover timer initialization, countdown behavior, button state transitions, and edge cases such as failed resend attempts not restarting the timer. [1] [2] [3] [4] [5] [6] [7] [8]
  • Utilized Jest fake timers in tests to simulate timer countdown and validate UI updates and resend restrictions. [1] [2]

These changes ensure a more robust and user-friendly password reset experience by enforcing resend limits and providing clear feedback to the user.

@Exo1i

Exo1i commented Dec 15, 2025

Copy link
Copy Markdown
Member Author

@github-actions

Copy link
Copy Markdown

Unit Tests Coverage Report

Coverage after merging feat/reset-password-timer into dev will be
91.93%
Coverage Report for Changed Files
FileStmtsBranchesFuncsLinesUncovered Lines
src/screens/auth/password
   ConfirmCode.tsx79.61%73.02%66.67%88.73%107, 119, 119, 119, 122, 127, 129, 129, 129, 132, 132, 132, 48, 64, 81, 81, 81, 84, 89, 91, 91, 91, 94, 94, 94

@Exo1i
Exo1i merged commit 90a277b into dev Dec 15, 2025
4 checks passed
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.

3 participants