Prevent validation using old OTP after resending new OTP

Created on 14 August 2025, 5 days ago

Problem/Motivation

After clicking 'Resend OTP', if the user enters the previously issued OTP, they are still able to validate and log in to the site. This creates a security issue because outdated OTPs remain valid.

Steps to reproduce

  1. Request an OTP for login.
  2. Before entering it, click 'Resend OTP' to generate a new one.
  3. Enter the original (old) OTP instead of the new one.
  4. Observe that login still succeeds.

Proposed resolution

Invalidate any previously generated OTP immediately when a new OTP is issued. Ensure that only the latest OTP can be used to validate and log in.

Remaining tasks

  • Review and test the provided patch.
  • Verify that old OTPs are rejected after resending.
  • Confirm no regressions for normal OTP flow.

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇮🇳India radheymkumar Jaipur, Rajasthan, India

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024