Class PasswordRecoveryServiceImpl

java.lang.Object
org.exoplatform.web.login.recovery.PasswordRecoveryServiceImpl
All Implemented Interfaces:
org.exoplatform.web.login.recovery.PasswordRecoveryService

public class PasswordRecoveryServiceImpl extends Object implements org.exoplatform.web.login.recovery.PasswordRecoveryService
  • Field Details

    • AUTHENTICATION_ATTEMPTS

      public static final String AUTHENTICATION_ATTEMPTS
      See Also:
    • TOKEN

      public static final org.exoplatform.web.controller.QualifiedName TOKEN
    • LANG

      public static final org.exoplatform.web.controller.QualifiedName LANG
    • NAME

      public static final String NAME
      See Also:
    • log

      protected static org.exoplatform.services.log.Log log
    • CONFIGURED_DOMAIN_URL_KEY

      public static final String CONFIGURED_DOMAIN_URL_KEY
      See Also:
  • Constructor Details

    • PasswordRecoveryServiceImpl

      public PasswordRecoveryServiceImpl(org.exoplatform.container.xml.InitParams initParams, org.exoplatform.services.organization.OrganizationService orgService, org.exoplatform.services.mail.MailService mailService, org.exoplatform.services.resources.ResourceBundleService bundleService, RemindPasswordTokenService remindPasswordTokenService, OnboardingTokenService onboardingTokenService, CookieTokenService cookieTokenService, org.exoplatform.web.WebAppController controller, org.exoplatform.portal.branding.BrandingService brandingService)
  • Method Details

    • addConnector

      public void addConnector(org.exoplatform.web.login.recovery.ChangePasswordConnector connector)
      Specified by:
      addConnector in interface org.exoplatform.web.login.recovery.PasswordRecoveryService
    • verifyToken

      public String verifyToken(String tokenId, String type)
      Specified by:
      verifyToken in interface org.exoplatform.web.login.recovery.PasswordRecoveryService
    • deleteToken

      public void deleteToken(String tokenId, String type)
      Specified by:
      deleteToken in interface org.exoplatform.web.login.recovery.PasswordRecoveryService
    • getOnboardingTokenValidity

      public long getOnboardingTokenValidity()
      Specified by:
      getOnboardingTokenValidity in interface org.exoplatform.web.login.recovery.PasswordRecoveryService
    • verifyToken

      public String verifyToken(String tokenId)
      Specified by:
      verifyToken in interface org.exoplatform.web.login.recovery.PasswordRecoveryService
    • allowChangePassword

      public boolean allowChangePassword(String username) throws Exception
      Specified by:
      allowChangePassword in interface org.exoplatform.web.login.recovery.PasswordRecoveryService
      Throws:
      Exception
    • changePass

      public boolean changePass(String tokenId, String tokenType, String username, String password)
      Specified by:
      changePass in interface org.exoplatform.web.login.recovery.PasswordRecoveryService
    • sendOnboardingEmail

      public boolean sendOnboardingEmail(org.exoplatform.services.organization.User user, Locale locale, StringBuilder url)
      Specified by:
      sendOnboardingEmail in interface org.exoplatform.web.login.recovery.PasswordRecoveryService
    • sendOnboardingEmail

      public boolean sendOnboardingEmail(org.exoplatform.services.organization.User user, Locale locale, StringBuilder url, String message)
      Specified by:
      sendOnboardingEmail in interface org.exoplatform.web.login.recovery.PasswordRecoveryService
    • buildOnboardingEmailBody

      protected String buildOnboardingEmailBody(org.exoplatform.services.organization.User user, ResourceBundle bundle, String link, String message, long validityMillis)
      Builds the onboarding email from its template: the administrator's message, HTML its caller has sanitized, is inserted as is above the link, and the link's validity is written in days when it is a whole number of days from two up, in whole hours otherwise
    • buildOnboardingMessageBlock

      protected static String buildOnboardingMessageBlock(String message)
      The message block of the onboarding email: the administrator's message as its caller hands it, HTML the caller has sanitized (the editor's markup, scripts and attributes removed), nothing when it is blank. The block is inserted by the one-pass fill, so a placeholder form inside the message stays text.
    • buildValidityLabel

      protected static String buildValidityLabel(ResourceBundle bundle, long validityMillis)
      The validity of a link as the email states it: in days when it is a whole number of days from two up, in whole hours otherwise (a day reads "24 hours")
    • isWholeDays

      protected static boolean isWholeDays(long validityMillis)
      Parameters:
      validityMillis - a validity in milliseconds
      Returns:
      true when the validity is stated in days: a whole number of days, from two up
    • fillTemplate

      protected static String fillTemplate(String template, Map<String,String> values)
      Fills every placeholder of the template in one pass: a value holding a placeholder's form stays text, and a placeholder with no value is removed
    • sendExternalRegisterEmail

      public String sendExternalRegisterEmail(String sender, String email, Locale locale, String space, StringBuilder url) throws Exception
      Specified by:
      sendExternalRegisterEmail in interface org.exoplatform.web.login.recovery.PasswordRecoveryService
      Throws:
      Exception
    • sendExternalRegisterEmail

      public String sendExternalRegisterEmail(String sender, String email, Locale locale, String space, StringBuilder url, boolean spaceInvitation) throws Exception
      Specified by:
      sendExternalRegisterEmail in interface org.exoplatform.web.login.recovery.PasswordRecoveryService
      Throws:
      Exception
    • sendExternalRegisterEmail

      public String sendExternalRegisterEmail(String sender, String email, Locale locale, String space, StringBuilder url, boolean spaceInvitation, String initialUri) throws Exception
      Specified by:
      sendExternalRegisterEmail in interface org.exoplatform.web.login.recovery.PasswordRecoveryService
      Throws:
      Exception
    • sendAccountVerificationEmail

      public boolean sendAccountVerificationEmail(String data, String username, String firstName, String lastName, String email, Locale locale, StringBuilder url)
      Specified by:
      sendAccountVerificationEmail in interface org.exoplatform.web.login.recovery.PasswordRecoveryService
    • sendAccountCreatedConfirmationEmail

      public boolean sendAccountCreatedConfirmationEmail(String username, Locale locale, StringBuilder url)
      Specified by:
      sendAccountCreatedConfirmationEmail in interface org.exoplatform.web.login.recovery.PasswordRecoveryService
    • sendRecoverPasswordEmail

      public boolean sendRecoverPasswordEmail(org.exoplatform.services.organization.User user, Locale defaultLocale, jakarta.servlet.http.HttpServletRequest req)
      Specified by:
      sendRecoverPasswordEmail in interface org.exoplatform.web.login.recovery.PasswordRecoveryService
    • getEmailSubject

      protected String getEmailSubject(org.exoplatform.services.organization.User user, ResourceBundle bundle)
    • getOnboardingURL

      public String getOnboardingURL(String tokenId, String lang)
      Specified by:
      getOnboardingURL in interface org.exoplatform.web.login.recovery.PasswordRecoveryService
    • getExternalRegistrationURL

      public String getExternalRegistrationURL(String tokenId, String lang)
      Specified by:
      getExternalRegistrationURL in interface org.exoplatform.web.login.recovery.PasswordRecoveryService
    • getPasswordRecoverURL

      public String getPasswordRecoverURL(String tokenId, String lang)
      Specified by:
      getPasswordRecoverURL in interface org.exoplatform.web.login.recovery.PasswordRecoveryService
    • getActiveChangePasswordConnector

      public org.exoplatform.web.login.recovery.ChangePasswordConnector getActiveChangePasswordConnector()
      Specified by:
      getActiveChangePasswordConnector in interface org.exoplatform.web.login.recovery.PasswordRecoveryService