Class MPasswordResetToken

All Implemented Interfaces:
Serializable, Cloneable, Comparator<Object>, I_AD_PasswordResetToken, I_Persistent, Evaluatee

public class MPasswordResetToken extends X_AD_PasswordResetToken
Password reset token model.

Persists a single password-reset request: the emailed 6-digit code (encrypted at rest) and, after the code is verified, the short-lived verified token (hashed) that authorizes setting a new password. Auto-registered with the model factory as the leaf subclass of the @Model-annotated X_AD_PasswordResetToken.

Author:
d-ruiz - IDEMPIERE-7060
See Also:
  • Constructor Details

    • MPasswordResetToken

      public MPasswordResetToken(Properties ctx, int AD_PasswordResetToken_ID, String trxName)
    • MPasswordResetToken

      public MPasswordResetToken(Properties ctx, int AD_PasswordResetToken_ID, String trxName, String... virtualColumns)
    • MPasswordResetToken

      public MPasswordResetToken(Properties ctx, String AD_PasswordResetToken_UU, String trxName)
    • MPasswordResetToken

      public MPasswordResetToken(Properties ctx, String AD_PasswordResetToken_UU, String trxName, String... virtualColumns)
    • MPasswordResetToken

      public MPasswordResetToken(Properties ctx, ResultSet rs, String trxName)
  • Method Details

    • expirePendingForEMail

      public static int expirePendingForEMail(String email, String trxName)
      Expire every still-pending reset token for the given email. Issuing a new code calls this so only the most recently emailed code remains verifiable.
      Parameters:
      email - token email
      trxName - transaction
      Returns:
      number of tokens expired
    • isCodeExpired

      public boolean isCodeExpired()
      Returns:
      true if the reset code has expired (or no expiration set)
    • isVerifiedTokenExpired

      public boolean isVerifiedTokenExpired()
      Returns:
      true if the verified token has expired (or none/not yet verified)
    • incrementAttempts

      public int incrementAttempts()
      Increment and store the used-attempts counter.
      Returns:
      the new number of attempts used