Class FailedSignInMails
java.lang.Object
com.iizix.server.user.FailedSignInMails
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:FailedSignInMails.Kind.NOTICE- one failed attempt, mailed at once (the first of a throttle interval);FailedSignInMails.Kind.BATCH- the failed attempts collected during the interval, listed in one mail;FailedSignInMails.Kind.WARNING- an attempt that got past the password, or any attempt on a sensitive account, mailed every time;FailedSignInMails.Kind.SUMMARY- the warnings held back past the hourly cap, listed in one mail.
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
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe mails.static enumThe paths that count a wrong password of an account and keep NO failed sign-in for it (CC-FIX-LOCK-PATHS-AND-RESET): a lock one of them starts is mailed withlockBody(FailedSignInMails.LockPath, UserInfoBase, FailedSignInStore.Attempt, String, String, long).Method Summary
Modifier and TypeMethodDescriptionstatic Stringbody(FailedSignInMails.Kind kind, UserInfoBase user, List<FailedSignInStore.Attempt> attempts, String signInURL, String lang, long lockedUntil) The text of a mail.static StringlockBody(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.static StringstepText(FailedSignInStep step, boolean afterPassword, String lang) The step of an attempt, in words, for the user's list.static Stringsubject(FailedSignInMails.Kind kind, List<FailedSignInStore.Attempt> attempts, String lang, long lockedUntil) The subject of a mail.
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
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.