Class PasswordResetRequests

java.lang.Object
com.iizix.server.user.PasswordResetRequests

public final class PasswordResetRequests extends Object
The accounts a self-service password reset names, and the one reset link mailed per account (EM-D-1, CC-FIX-SIGNIN-ACCOUNT-MAIL): the identifier the user typed names an account by its user name, else EVERY account that holds it as its registered e-mail address - a shared address is allowed (a personal account and an administrator account behind one support mailbox), and each account gets its own link, in a mail that names the account ("Dear"). Before, the first account holding the address got the one link and the others nothing.

Nothing here tells the caller apart from an unknown identifier: the refusals are logged, as IUserAuthenticationUI.requestPasswordReset documents (D-19, no enumeration).

Author:
Christopher Mindus
  • Method Details

    • accountsOf

      public static List<BasicUserInfo> accountsOf(String identifier) throws NotFoundException
      Gets the accounts an identifier names: the user of that name when there is one, else every user holding the identifier as its registered address (an identifier with @, matched exactly as registered).
      Parameters:
      identifier - The user name or the e-mail address, as typed and trimmed.
      Returns:
      The accounts, in the order of the database; empty for none.
      Throws:
      NotFoundException - If the database cannot be read (with the SQL exception as the cause).
    • refusal

      public static String refusal(BasicUserInfo bui)
      Why no reset link goes to an account: disabled, an external Sign In Provider's, a fixed password, or no e-mail address.
      Parameters:
      bui - The account.
      Returns:
      The reason, for the log; null when a link may go.
    • mailLinks

      public static int mailLinks(List<BasicUserInfo> accounts, Predicate<BasicUserInfo> admitted, long intervalMs, Function<BasicUserInfo, String> link, MailSender sender, AccountEmailChange.IMailStep deliver, String source)
      Mails one reset link per account: each account that is not refused (refusal(BasicUserInfo)) and is admitted by the per-account interval gets its own link, in a mail to its registered address that names it (PasswordResetMail.composeLink(MailSender, String, String, String)). Every refusal is one INFO line; a link or a mail that could not be made is one SEVERE line; nothing throws.
      Parameters:
      accounts - The accounts, as accountsOf(String) gives them.
      admitted - Admits an account for one mail per interval (the source throttle's key).
      intervalMs - The interval, for the log.
      link - Makes the sealed reset link of an account; null when none can be made.
      sender - The mail sender.
      deliver - The delivery step (the production step sends in the background).
      source - The source key of the request, for the log.
      Returns:
      The count of mails handed to the delivery step.