Skip to main content

ForgotPasswordDialog

Overview of ForgotPasswordDialog

ForgotPasswordDialog is a modal component that handles the OTP verification step for resetting a user’s password. It includes input for username and OTP, and integrates loading and validation states.

Props

PropTypeDescription
visiblebooleanControls the visibility of the dialog.
onClosefunctionCallback function to hide the dialog.
onOtpValidatedfunctionCalled after successful OTP validation.
handleGetOtpfunctionTriggered when requesting OTP.
handleValidateOtpfunctionTriggered to validate the entered OTP.
otpSentLoadingbooleanIndicates if OTP sending is in progress.
setOtpSentLoadingfunctionState setter for otpSentLoading.
otpSentbooleanWhether OTP has been sent successfully.
setOtpSentfunctionState setter for otpSent.
otpstringThe OTP value.
setOtpfunctionState setter for otp.
forgotPasswordUsernamestringUsername input for password reset.
setForgotPasswordUsernamefunctionState setter for forgotPasswordUsername.
otpErrorstringError message related to OTP validation.
setOtpErrorfunctionState setter for otpError.
otpSentEmailstringEmail address where OTP is sent.
setOtpSentEmailfunctionState setter for otpSentEmail.
otpValidateLoadingbooleanIndicates if OTP validation is in progress.

Behavior

  • Shows input for username and OTP.
  • OTP field and proceed button appear only after OTP is sent.
  • Triggers the next step on successful OTP validation.

Example Usage

<ForgotPasswordDialog
visible={showForgotPassword}
onClose={() => setShowForgotPassword(false)}
onOtpValidated={handleOtpValidated}
handleGetOtp={handleGetOtp}
handleValidateOtp={handleValidateOtp}
otpSentLoading={otpSentLoading}
setOtpSentLoading={setOtpSentLoading}
otpSent={otpSent}
setOtpSent={setOtpSent}
otp={otp}
setOtp={setOtp}
forgotPasswordUsername={forgotPasswordUsername}
setForgotPasswordUsername={setForgotPasswordUsername}
otpError={otpError}
setOtpError={setOtpError}
otpSentEmail={otpSentEmail}
setOtpSentEmail={setOtpSentEmail}
otpValidateLoading={otpValidateLoading}
/>