Repository navigation
v0.2.0
Minor Changes
-
7bc8714: Add built-in emails that confirm an account deletion and tell the owner once the account is deleted.
confirmAccountDeletionasks the owner to confirm the deletion with a button toconfirmUrl, and warns that a deleted account and its data can't be restored. Props:confirmUrl,userName,expiresInMinutes(ConfirmAccountDeletionProps).accountDeletedtells the owner that the account was deleted, with a way to contact support if it wasn't them (supportUrl, elsebranding.supportEmail). Every prop is optional:userName,supportUrl(AccountDeletedProps).- Texts in English and Belarusian, overridable through
messagesin theconfirmAccountDeletionandaccountDeletedsections. Apps that keep deleted accounts for a grace period can rewordconfirmAccountDeletion.warningandaccountDeleted.farewell.
-
45611f1: Add built-in templates for changing the email address.
verifyEmailChangegoes to the new address and asks the user to confirm it. Props:verifyUrl,userName,expiresInMinutes(VerifyEmailChangeProps).emailChangeRequestedgoes to the current address when a change is requested. It namesnewEmailand offers a button that cancels the change (cancelUrl), or a way to contact support without it (supportUrl, elsebranding.supportEmail). Props:newEmail,userName,requestedAt,timeZone,ip,cancelUrl,supportUrl(EmailChangeRequestedProps).emailChangedgoes to the old address once the change is done, with a way to contact support. Every prop is optional:userName,newEmail,changedAt,timeZone,ip,supportUrl(EmailChangedProps).newEmailaccepts any non-empty text, so a masked address such asl***@example.comworks.- Texts in English and Belarusian, overridable through
messagesin theverifyEmailChange,emailChangeRequestedandemailChangedsections. Messagesdescribes the full built-in dictionary and gains keys whenever built-in templates are added, in any release, so a full dictionary typed asMessagesis not covered by semver. UseMessagesOverrides(orLocaleMessagesfor one locale) for your own texts; keys you leave out fall back to English.- Polish the Belarusian wording of the
resetPasswordintro: «Націсніце кнопку, каб задаць новы пароль.» - Migration: if you type a full dictionary as
Messages, add theverifyEmailChange,emailChangeRequestedandemailChangedsections, or check it withsatisfies MessagesOverridesinstead, so that missing keys fall back to English.
-
ffa8d14: Add built-in security notices for new sign-ins, two-factor authentication changes and locked accounts.
newSignIntells the owner about a sign-in, such as from a new device, and listssignedInAt,device,locationandipwhen you pass them. It offers a button to a page that secures the account (secureUrl), or a way to contact support without it (supportUrl, elsebranding.supportEmail). Every prop is optional:userName,signedInAt,timeZone,ip,device,location,secureUrl,supportUrl(NewSignInProps).twoFactorEnabledandtwoFactorDisabledtell the owner that two-factor authentication was turned on or off, with a way to contact support. Every prop is optional:userName,changedAt,timeZone,ip,supportUrl(TwoFactorEnabledProps,TwoFactorDisabledProps).accountLockedtells the owner that the account was locked after too many failed sign-in attempts, showslockedUntilandipwhen you pass them, and offers a button that unlocks the account (unlockUrl), or help from support without it (supportUrl, elsebranding.supportEmail). It ends with advice to choose a new password for owners who did not try to sign in. Every prop is optional:userName,lockedUntil,timeZone,ip,unlockUrl,supportUrl(AccountLockedProps).- Texts in English and Belarusian, overridable through
messagesin thenewSignIn,twoFactorEnabled,twoFactorDisabledandaccountLockedsections.
-
a32a33f: Add built-in templates for one-time codes, sign-in links and welcome emails.
otpCodesends a one-time code for sign-in, two-step verification or confirming an action. Props:code,userName,expiresInMinutes(OtpCodeProps). The subject and inbox preview leave out the code, because they show in notifications and on lock screens; both texts accept{code}, so amessagesoverride can add it.magicLinksends a link that signs the user in without a password and tells the reader not to share it. Props:signInUrl,userName,expiresInMinutes(MagicLinkProps).welcomegreets a new user with a button toctaUrl, or tobranding.appUrlwithout it. Every prop is optional:userName,ctaUrl(WelcomeProps).- Texts in English and Belarusian, overridable through
messagesin theotpCode,magicLinkandwelcomesections.
Patch Changes
-
99f9462: Add attachments and inline images.
mailer.sendacceptsattachments: files with afilename,content(aBuffer, aUint8Array, or text sent as UTF-8), an optionalcontentTypeand an optionalcid. WithoutcontentType, the type is guessed from the file name extension, withapplication/octet-streamas the fallback, and text content gets; charset=utf-8.- An attachment with a
cidis an inline image that the HTML shows throughcid:<cid>. After rendering,sendchecks the HTML, layout included, and rejects withINVALID_OPTIONSnaming everycid:reference without an attachment, before anything is sent. An attachment whosecidthe HTML never references is sent as a regular attachment. ui.image(src, { alt, width, height })shows an image from an absolutehttp:orhttps:URL, or an attachment through acid:reference. It renders email-safe markup with an explicit width (534 px, the content width, by default and at most), shrinks on narrow screens, and shows the alt text in the plain-text version. An invalid source throwsUNSAFE_URL.- File names and content types with line breaks or other control characters are rejected with
INVALID_OPTIONS, so attachments cannot inject MIME headers through any transport. Content types must be MIME types, and aciduses ASCII letters, digits,.,_,-and@and is unique within an email. smtpTransportdelivers attachments, with inline images next to the HTML.consoleTransportprints the name, type and size of each attachment, andmemoryTransportrecords them insent.OutgoingMessagehas an optionalattachmentslist, in whichcontentTypeis always set andcidis set only on referenced inline images. A custom transport must deliver every attachment or reject.- Hook events list the
filename,contentTypeandsizeof each attachment, never its content. - Types
Attachment,OutgoingAttachment,AttachmentInfoandImageOptions.