Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

feat: expose auth reauthentication template (#22138)

Joel Leee86bd5255698
diff --git a/apps/studio/components/interfaces/Auth/AuthTemplatesValidation.tsx b/apps/studio/components/interfaces/Auth/AuthTemplatesValidation.tsx
index d6e8f48ae09..cfc574698ec 100644
--- a/apps/studio/components/interfaces/Auth/AuthTemplatesValidation.tsx
+++ b/apps/studio/components/interfaces/Auth/AuthTemplatesValidation.tsx
@@ -178,5 +178,43 @@ const RECOVERY: FormSchema = {
[Learn more](https://supabase.com/docs/guides/auth/social-login/auth-apple#configure-your-services-id)`,
},
}
+const REAUTHENTICATION: FormSchema = {
+ $schema: JSON_SCHEMA_VERSION,
+ id: 'REAUTHENTICATION',
+ type: 'object',
+ title: 'Reauthentication',
+ properties: {
+ MAILER_SUBJECTS_REAUTHENTICATION: {
+ title: 'Subject heading',
+ type: 'string',
+ },
+ MAILER_TEMPLATES_REAUTHENTICATION_CONTENT: {
+ title: 'Message body',
+ descriptionOptional: 'HTML body of your email',
+ type: 'code',
+ description: `
+- \`{{ .Token }}\` : The 6-digit numeric email OTP
+- \`{{ .SiteURL }}\` : The URL of the site
+- \`{{ .Email }}\` : The user's email address
+- \`{{ .Data }}\` : The user's \`user_metadata\`
+`,
+ },
+ },
+ validationSchema: object().shape({
+ MAILER_SUBJECTS_REAUTHENTICATION: string().required('"Subject heading is required.'),
+ }),
+ misc: {
+ iconKey: 'email-icon2',
+ helper: `To complete setup, add this authorisation callback URL to your app's configuration in the Apple Developer Console.
+ [Learn more](https://supabase.com/docs/guides/auth/social-login/auth-apple#configure-your-services-id)`,
+ },
+}
-export const TEMPLATES_SCHEMAS = [CONFIRMATION, INVITE, MAGIC_LINK, EMAIL_CHANGE, RECOVERY]
+export const TEMPLATES_SCHEMAS = [
+ CONFIRMATION,
+ INVITE,
+ MAGIC_LINK,
+ EMAIL_CHANGE,
+ RECOVERY,
+ REAUTHENTICATION,
+]
diff --git a/apps/studio/pages/api/auth/[ref]/config.ts b/apps/studio/pages/api/auth/[ref]/config.ts
index 19ab6e288d8..1faef0ce619 100644
--- a/apps/studio/pages/api/auth/[ref]/config.ts
+++ b/apps/studio/pages/api/auth/[ref]/config.ts
@@ -120,6 +120,7 @@ const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => {
MAILER_SUBJECTS_RECOVERY: 'Reset Your Password',
MAILER_SUBJECTS_EMAIL_CHANGE: 'Confirm Email Change',
MAILER_SUBJECTS_MAGIC_LINK: 'Your Magic Link',
+ MAILER_SUBJECTS_REAUTHENTICATION: 'Confirm Reauthentication',
MAILER_TEMPLATES_INVITE: null,
MAILER_TEMPLATES_INVITE_CONTENT:
'<h2>You have been invited</h2>\n\n<p>You have been invited to create a user on {{ .SiteURL }}. Follow this link to accept the invite:</p>\n<p><a href="{{ .ConfirmationURL }}">Accept the invite</a></p>',
@@ -166,6 +167,9 @@ const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => {
SMS_VONAGE_FROM: null,
SMS_TEXTLOCAL_API_KEY: null,
SMS_TEXTLOCAL_SENDER: null,
+ MAILER_TEMPLATES_REAUTHENTICATION: null,
+ MAILER_TEMPLATES_REAUTHENTICATION_CONTENT:
+ '<h2>Confirm reauthentication</h2> <p>Enter the code: {{ .Token }}</p>',
})
}