Class DefaultPasswordResetService

java.lang.Object
org.adempiere.base.DefaultPasswordResetService
All Implemented Interfaces:
IPasswordResetService

public class DefaultPasswordResetService extends Object implements IPasswordResetService
Default IPasswordResetService implementation (code-based reset).
Author:
d-ruiz - IDEMPIERE-7060
  • Constructor Details

    • DefaultPasswordResetService

      public DefaultPasswordResetService()
  • Method Details

    • requestReset

      public void requestReset(String email, int AD_Client_ID, String language)
      Description copied from interface: IPasswordResetService
      Request a password reset for the given email. Generates a numeric code, persists it hashed with an expiry, and emails it to the address. Behaves neutrally (no account enumeration): a non-matching email produces no observable difference. May throw when the per-identifier request rate limits are exceeded.
      Specified by:
      requestReset in interface IPasswordResetService
      Parameters:
      email - the email address / login identifier
      AD_Client_ID - tenant context used to resolve configuration (may be 0)
      language - AD_Language used for the email template (may be null)
    • verifyCode

      public String verifyCode(String email, String code)
      Description copied from interface: IPasswordResetService
      Verify a code previously sent to the email. On success mints and stores a high-entropy verified token and returns its plaintext value. Throws an AdempiereException carrying the appropriate message on invalid/expired code or when attempts are exceeded.
      Specified by:
      verifyCode in interface IPasswordResetService
      Parameters:
      email - the email address / login identifier
      code - the code entered by the user
      Returns:
      the plaintext verified token to pass to IPasswordResetService.completeReset(String, String)
    • completeReset

      public void completeReset(String verifiedToken, String newPassword)
      Description copied from interface: IPasswordResetService
      Complete the reset: validate the verified token and set the new password for every active user sharing the identifier (all tenants), then invalidate their existing sessions. Password policy is enforced by the standard MUser save path.
      Specified by:
      completeReset in interface IPasswordResetService
      Parameters:
      verifiedToken - the plaintext token returned by IPasswordResetService.verifyCode(String, String)
      newPassword - the new password chosen by the user