mirror of
https://github.com/logto-io/logto.git
synced 2025-01-13 21:30:30 -05:00
chore(toolkit): add email service branding config guard (#4085)
This commit is contained in:
parent
752d39b2ab
commit
850cd3e342
1 changed files with 17 additions and 0 deletions
|
@ -209,6 +209,23 @@ export type EmailConnector = BaseConnector<ConnectorType.Email> & {
|
|||
sendMessage: SendMessageFunction;
|
||||
};
|
||||
|
||||
export const urlRegEx =
|
||||
/(https?:\/\/)?(?:www\.)?[\w#%+.:=@~-]{1,256}\.[\d()A-Za-z]{1,6}\b[\w#%&()+./:=?@~-]*/;
|
||||
|
||||
export const emailServiceBrandingGuard = z
|
||||
.object({
|
||||
fromName: z
|
||||
.string()
|
||||
.refine((address) => !urlRegEx.test(address), 'DO NOT include URL in the sender name!'),
|
||||
companyAddress: z
|
||||
.string()
|
||||
.refine((address) => !urlRegEx.test(address), 'DO NOT include URL in the company address!'),
|
||||
appLogo: z.string().url(),
|
||||
})
|
||||
.partial();
|
||||
|
||||
export type EmailServiceBranding = z.infer<typeof emailServiceBrandingGuard>;
|
||||
|
||||
export const sendMessagePayloadGuard = z.object({
|
||||
to: z.string(),
|
||||
type: verificationCodeTypeGuard,
|
||||
|
|
Loading…
Add table
Reference in a new issue