Class FailedSignInMails

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

public final class FailedSignInMails extends Object
The texts of the mails about failed sign-ins (CC-SIGNIN-FAILED-ATTEMPTS, order 561), in the user's language (English, French or Swedish, as AccountNotices.languageOf(UserInfoBase)): what happened, when, from where (the client address, its approximate place, the device), at which step, into which application, and what to do. Four mails:No mail carries a secret, and none names the step in a way that tells the reader more than the reader knows already: the user's own account, the user's own password.

A mail written while the account is LOCKED after too many failed sign-ins (AccountHold; CC-FIX-SIGNIN-HOLD-FOLLOWUP) says so first, with the time the lock ends, and its subject is the lock: until that order no mail said anything of the lock, so the attempt that locked the account was mailed as any other failed sign-in.

Author:
Christopher Mindus
  • Method Details

    • subject

      public static String subject(FailedSignInMails.Kind kind, List<FailedSignInStore.Attempt> attempts, String lang, long lockedUntil)
      The subject of a mail.
      Parameters:
      kind - The mail.
      attempts - The attempts it is about, at least one.
      lang - The language, "en", "fr" or "sv".
      lockedUntil - When the lock of the account ends, in milliseconds since the epoch, while the account is locked (AccountHold.heldUntil(UserInfoBase, long)); zero when it is not. The subject of a locked account is the lock, whatever the kind.
      Returns:
      The subject.
    • body

      public static String body(FailedSignInMails.Kind kind, UserInfoBase user, List<FailedSignInStore.Attempt> attempts, String signInURL, String lang, long lockedUntil)
      The text of a mail.
      Parameters:
      kind - The mail.
      user - The user.
      attempts - The attempts it is about, at least one, the oldest first for a list.
      signInURL - The sign-in page of the server (its configured external URL), null for none.
      lang - The language, "en", "fr" or "sv".
      lockedUntil - When the lock of the account ends, in milliseconds since the epoch, while the account is locked (AccountHold.heldUntil(UserInfoBase, long)); zero when it is not. The text of a locked account says so first, with that time.
      Returns:
      The plain text.
    • lockBody

      public static String lockBody(FailedSignInMails.LockPath path, UserInfoBase user, FailedSignInStore.Attempt told, String signInURL, String lang, long lockedUntil)
      The text of the mail of a lock that a wrong password started on a path that keeps no failed sign-in (FailedSignInMails.LockPath; CC-FIX-LOCK-PATHS-AND-RESET): the lock first, as in every mail written while the account is locked, then that the wrong password is not in the user's list, when, from where and by which path it came.
      Parameters:
      path - The path.
      user - The user.
      told - The wrong password that started the lock, as an attempt that is NOT kept: its time, address, place, device and application.
      signInURL - The sign-in page of the server (its configured external URL), null for none.
      lang - The language, "en", "fr" or "sv".
      lockedUntil - When the lock ends, in milliseconds since the epoch.
      Returns:
      The plain text.
      Throws:
      NullPointerException - If the path is null.
    • stepText

      public static String stepText(FailedSignInStep step, boolean afterPassword, String lang)
      The step of an attempt, in words, for the user's list.
      Parameters:
      step - The step.
      afterPassword - Whether the password was right.
      lang - The language, "en", "fr" or "sv".
      Returns:
      The words, "the password" for FailedSignInStep.PASSWORD.