The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Auth interface components new page components (#40670)
Saxon Fletcheradf760ebf41f
diff --git a/apps/studio/components/interfaces/Auth/AdvancedAuthSettingsForm.tsx b/apps/studio/components/interfaces/Auth/AdvancedAuthSettingsForm.tsxindex f52b241cb08..365f3ea1c50 100644--- a/apps/studio/components/interfaces/Auth/AdvancedAuthSettingsForm.tsx+++ b/apps/studio/components/interfaces/Auth/AdvancedAuthSettingsForm.tsx@@ -6,7 +6,6 @@ import { toast } from 'sonner'import * as z from 'zod'import { useParams } from 'common'-import { ScaffoldSection, ScaffoldSectionTitle } from 'components/layouts/Scaffold'import AlertError from 'components/ui/AlertError'import { StringNumberOrNull } from 'components/ui/Forms/Form.constants'import NoPermission from 'components/ui/NoPermission'@@ -29,6 +28,13 @@ import {} from 'ui'import { GenericSkeletonLoader } from 'ui-patterns'import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'+import {+ PageSection,+ PageSectionContent,+ PageSectionMeta,+ PageSectionSummary,+ PageSectionTitle,+} from 'ui-patterns/PageSection'const FormSchema = z.object({API_MAX_REQUEST_DURATION: z.coerce@@ -151,25 +157,31 @@ export const AdvancedAuthSettingsForm = () => {if (isError) {return (- <ScaffoldSection isFullWidth>- <AlertError error={authConfigError} subject="Failed to retrieve auth configuration" />- </ScaffoldSection>+ <PageSection>+ <PageSectionContent>+ <AlertError error={authConfigError} subject="Failed to retrieve auth configuration" />+ </PageSectionContent>+ </PageSection>)}if (!canReadConfig) {return (- <ScaffoldSection isFullWidth>- <NoPermission resourceText="view auth configuration settings" />- </ScaffoldSection>+ <PageSection>+ <PageSectionContent>+ <NoPermission resourceText="view auth configuration settings" />+ </PageSectionContent>+ </PageSection>)}if (isLoading) {return (- <ScaffoldSection isFullWidth>- <GenericSkeletonLoader />- </ScaffoldSection>+ <PageSection>+ <PageSectionContent>+ <GenericSkeletonLoader />+ </PageSectionContent>+ </PageSection>)}@@ -184,118 +196,128 @@ export const AdvancedAuthSettingsForm = () => {/></div>)}- <ScaffoldSection isFullWidth>- <ScaffoldSectionTitle className="mb-4">Request Duration</ScaffoldSectionTitle>+ <PageSection>+ <PageSectionMeta>+ <PageSectionSummary>+ <PageSectionTitle>Request Duration</PageSectionTitle>+ </PageSectionSummary>+ </PageSectionMeta>+ <PageSectionContent>+ <Form_Shadcn_ {...requestDurationForm}>+ <form+ onSubmit={requestDurationForm.handleSubmit(onSubmitRequestDurationForm)}+ className="space-y-4"+ >+ <Card>+ <CardContent className="pt-6">+ <FormField_Shadcn_+ control={requestDurationForm.control}+ name="API_MAX_REQUEST_DURATION"+ render={({ field }) => (+ <FormItemLayout+ layout="flex-row-reverse"+ label="Maximum time allowed for an Auth request to last"+ description="Number of seconds to wait for an Auth request to complete before canceling it. In certain high-load situations setting a larger or smaller value can be used to control load-shedding. Recommended: 10 seconds."+ >+ <FormControl_Shadcn_>+ <div className="relative">+ <PrePostTab postTab="seconds">+ <Input_Shadcn_+ type="number"+ min={5}+ max={30}+ {...field}+ disabled={!canUpdateConfig || promptTeamsEnterpriseUpgrade}+ />+ </PrePostTab>+ </div>+ </FormControl_Shadcn_>+ </FormItemLayout>+ )}+ />+ </CardContent>- <Form_Shadcn_ {...requestDurationForm}>- <form- onSubmit={requestDurationForm.handleSubmit(onSubmitRequestDurationForm)}- className="space-y-4"- >- <Card>- <CardContent className="pt-6">- <FormField_Shadcn_- control={requestDurationForm.control}- name="API_MAX_REQUEST_DURATION"- render={({ field }) => (- <FormItemLayout- layout="flex-row-reverse"- label="Maximum time allowed for an Auth request to last"- description="Number of seconds to wait for an Auth request to complete before canceling it. In certain high-load situations setting a larger or smaller value can be used to control load-shedding. Recommended: 10 seconds."- >- <FormControl_Shadcn_>- <div className="relative">- <PrePostTab postTab="seconds">- <Input_Shadcn_- type="number"- min={5}- max={30}- {...field}- disabled={!canUpdateConfig || promptTeamsEnterpriseUpgrade}- />- </PrePostTab>- </div>- </FormControl_Shadcn_>- </FormItemLayout>+ <CardFooter className="justify-end space-x-2">+ {requestDurationForm.formState.isDirty && (+ <Button type="default" onClick={() => requestDurationForm.reset()}>+ Cancel+ </Button>)}- />- </CardContent>-- <CardFooter className="justify-end space-x-2">- {requestDurationForm.formState.isDirty && (- <Button type="default" onClick={() => requestDurationForm.reset()}>- Cancel+ <Button+ type="primary"+ htmlType="submit"+ disabled={+ !canUpdateConfig ||+ isUpdatingRequestDurationForm ||+ !requestDurationForm.formState.isDirty ||+ promptTeamsEnterpriseUpgrade+ }+ loading={isUpdatingRequestDurationForm}+ >+ Save changes</Button>- )}- <Button- type="primary"- htmlType="submit"- disabled={- !canUpdateConfig ||- isUpdatingRequestDurationForm ||- !requestDurationForm.formState.isDirty ||- promptTeamsEnterpriseUpgrade- }- loading={isUpdatingRequestDurationForm}- >- Save changes- </Button>- </CardFooter>- </Card>- </form>- </Form_Shadcn_>- </ScaffoldSection>+ </CardFooter>+ </Card>+ </form>+ </Form_Shadcn_>+ </PageSectionContent>+ </PageSection>- <ScaffoldSection isFullWidth>- <ScaffoldSectionTitle className="mb-4">Auth Database Connections</ScaffoldSectionTitle>+ <PageSection>+ <PageSectionMeta>+ <PageSectionSummary>+ <PageSectionTitle>Auth Database Connections</PageSectionTitle>+ </PageSectionSummary>+ </PageSectionMeta>+ <PageSectionContent>+ <Form_Shadcn_ {...databaseForm}>+ <form onSubmit={databaseForm.handleSubmit(onSubmitDatabaseForm)} className="space-y-4">+ <Card>+ <CardContent className="pt-6">+ <FormField_Shadcn_+ control={databaseForm.control}+ name="DB_MAX_POOL_SIZE"+ render={({ field }) => (+ <FormItemLayout+ layout="flex-row-reverse"+ label="Max Direct Auth Connections"+ description="Auth will take up no more than this number of connections from the total number of available connections to serve requests. These connections are not reserved, so when unused they are released. Defaults to 10 connections."+ >+ <FormControl_Shadcn_>+ <Input_Shadcn_+ type="number"+ placeholder="10"+ {...field}+ disabled={!canUpdateConfig || promptTeamsEnterpriseUpgrade}+ />+ </FormControl_Shadcn_>+ </FormItemLayout>+ )}+ />+ </CardContent>- <Form_Shadcn_ {...databaseForm}>- <form onSubmit={databaseForm.handleSubmit(onSubmitDatabaseForm)} className="space-y-4">- <Card>- <CardContent className="pt-6">- <FormField_Shadcn_- control={databaseForm.control}- name="DB_MAX_POOL_SIZE"- render={({ field }) => (- <FormItemLayout- layout="flex-row-reverse"- label="Max Direct Auth Connections"- description="Auth will take up no more than this number of connections from the total number of available connections to serve requests. These connections are not reserved, so when unused they are released. Defaults to 10 connections."- >- <FormControl_Shadcn_>- <Input_Shadcn_- type="number"- placeholder="10"- {...field}- disabled={!canUpdateConfig || promptTeamsEnterpriseUpgrade}- />- </FormControl_Shadcn_>- </FormItemLayout>+ <CardFooter className="justify-end space-x-2">+ {databaseForm.formState.isDirty && (+ <Button type="default" onClick={() => databaseForm.reset()}>+ Cancel+ </Button>)}- />- </CardContent>-- <CardFooter className="justify-end space-x-2">- {databaseForm.formState.isDirty && (- <Button type="default" onClick={() => databaseForm.reset()}>- Cancel+ <Button+ type="primary"+ htmlType="submit"+ disabled={+ !canUpdateConfig || isUpdatingDatabaseForm || !databaseForm.formState.isDirty+ }+ loading={isUpdatingDatabaseForm}+ >+ Save changes</Button>- )}- <Button- type="primary"- htmlType="submit"- disabled={- !canUpdateConfig || isUpdatingDatabaseForm || !databaseForm.formState.isDirty- }- loading={isUpdatingDatabaseForm}- >- Save changes- </Button>- </CardFooter>- </Card>- </form>- </Form_Shadcn_>- </ScaffoldSection>+ </CardFooter>+ </Card>+ </form>+ </Form_Shadcn_>+ </PageSectionContent>+ </PageSection></>)}diff --git a/apps/studio/components/interfaces/Auth/AuditLogsForm.tsx b/apps/studio/components/interfaces/Auth/AuditLogsForm.tsxindex 41eb312f2c0..2360c85a048 100644--- a/apps/studio/components/interfaces/Auth/AuditLogsForm.tsx+++ b/apps/studio/components/interfaces/Auth/AuditLogsForm.tsx@@ -6,7 +6,6 @@ import { toast } from 'sonner'import { boolean, object } from 'yup'import { useParams } from 'common'-import { ScaffoldSection, ScaffoldSectionTitle } from 'components/layouts/Scaffold'import AlertError from 'components/ui/AlertError'import { InlineLink } from 'components/ui/InlineLink'import { useAuthConfigQuery } from 'data/auth/auth-config-query'@@ -26,6 +25,13 @@ import {} from 'ui'import { Admonition, GenericSkeletonLoader } from 'ui-patterns'import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'+import {+ PageSection,+ PageSectionContent,+ PageSectionMeta,+ PageSectionSummary,+ PageSectionTitle,+} from 'ui-patterns/PageSection'const schema = object({AUDIT_LOG_DISABLE_POSTGRES: boolean().required(),@@ -87,28 +93,35 @@ export const AuditLogsForm = () => {if (isError) {return (- <ScaffoldSection isFullWidth>- <AlertError- error={authConfigError}- subject="Failed to retrieve auth configuration for hooks"- />- </ScaffoldSection>+ <PageSection>+ <PageSectionContent>+ <AlertError+ error={authConfigError}+ subject="Failed to retrieve auth configuration for hooks"+ />+ </PageSectionContent>+ </PageSection>)}if (isLoading) {return (- <ScaffoldSection isFullWidth>- <GenericSkeletonLoader />- </ScaffoldSection>+ <PageSection>+ <PageSectionContent>+ <GenericSkeletonLoader />+ </PageSectionContent>+ </PageSection>)}return (- <ScaffoldSection isFullWidth>- <div className="space-y-4">- <ScaffoldSectionTitle className="mb-4">Settings</ScaffoldSectionTitle>-+ <PageSection>+ <PageSectionMeta>+ <PageSectionSummary>+ <PageSectionTitle>Settings</PageSectionTitle>+ </PageSectionSummary>+ </PageSectionMeta>+ <PageSectionContent><Form_Shadcn_ {...form}><form onSubmit={form.handleSubmit(onSubmitAuditLogs)} className="space-y-4"><Card>@@ -193,7 +206,7 @@ export const AuditLogsForm = () => {</Card></form></Form_Shadcn_>- </div>- </ScaffoldSection>+ </PageSectionContent>+ </PageSection>)}diff --git a/apps/studio/components/interfaces/Auth/AuthProvidersForm/index.tsx b/apps/studio/components/interfaces/Auth/AuthProvidersForm/index.tsxindex dddd421f145..0bcc1674bc9 100644--- a/apps/studio/components/interfaces/Auth/AuthProvidersForm/index.tsx+++ b/apps/studio/components/interfaces/Auth/AuthProvidersForm/index.tsx@@ -2,16 +2,10 @@ import { ExternalLink } from 'lucide-react'import Link from 'next/link'import { useParams } from 'common'-import {- ScaffoldSection,- ScaffoldSectionDescription,- ScaffoldSectionTitle,-} from 'components/layouts/Scaffold'import AlertError from 'components/ui/AlertError'import { ResourceList } from 'components/ui/Resource/ResourceList'import { HorizontalShimmerWithIcon } from 'components/ui/Shimmers'import { useAuthConfigQuery } from 'data/auth/auth-config-query'-import { DOCS_URL } from 'lib/constants'import {Alert_Shadcn_,AlertDescription_Shadcn_,@@ -19,6 +13,14 @@ import {Button,WarningIcon,} from 'ui'+import {+ PageSection,+ PageSectionContent,+ PageSectionDescription,+ PageSectionMeta,+ PageSectionSummary,+ PageSectionTitle,+} from 'ui-patterns/PageSection'import { getPhoneProviderValidationSchema, PROVIDERS_SCHEMAS } from '../AuthProvidersFormValidation'import type { Provider } from './AuthProvidersForm.types'import { ProviderForm } from './ProviderForm'@@ -34,88 +36,93 @@ export const AuthProvidersForm = () => {} = useAuthConfigQuery({ projectRef })return (- <ScaffoldSection isFullWidth>- <ScaffoldSectionTitle>Auth Providers</ScaffoldSectionTitle>- <ScaffoldSectionDescription className="mb-4">- Authenticate your users through a suite of providers and login methods- </ScaffoldSectionDescription>-- {isError ? (- <AlertError- error={authConfigError}- subject="Failed to retrieve auth configuration for hooks"- />- ) : (- <div className="-space-y-px">- {authConfig?.EXTERNAL_EMAIL_ENABLED && authConfig?.MAILER_OTP_EXP > 3600 && (- <Alert_Shadcn_- className="flex w-full items-center justify-between my-3"- variant="warning"- >- <WarningIcon />- <div>- <AlertTitle_Shadcn_>OTP expiry exceeds recommended threshold</AlertTitle_Shadcn_>- <AlertDescription_Shadcn_ className="flex flex-col gap-y-3">- <p>- We have detected that you have enabled the email provider with the OTP expiry- set to more than an hour. It is recommended to set this value to less than an- hour.- </p>- <Button asChild type="default" className="w-min" icon={<ExternalLink />}>- <Link href={`${DOCS_URL}/guides/platform/going-into-prod#security`}>- View security recommendations- </Link>- </Button>- </AlertDescription_Shadcn_>- </div>- </Alert_Shadcn_>- )}-- <ResourceList>- {isLoading &&- PROVIDERS_SCHEMAS.map((provider) => (- <div- key={`provider_${provider.title}`}- className="py-4 px-6 border-b last:border-b-none"- >- <HorizontalShimmerWithIcon />+ <PageSection>+ <PageSectionMeta>+ <PageSectionSummary>+ <PageSectionTitle>Auth Providers</PageSectionTitle>+ <PageSectionDescription>+ Authenticate your users through a suite of providers and login methods+ </PageSectionDescription>+ </PageSectionSummary>+ </PageSectionMeta>+ <PageSectionContent>+ {isError ? (+ <AlertError+ error={authConfigError}+ subject="Failed to retrieve auth configuration for hooks"+ />+ ) : (+ <div className="-space-y-px">+ {authConfig?.EXTERNAL_EMAIL_ENABLED && authConfig?.MAILER_OTP_EXP > 3600 && (+ <Alert_Shadcn_+ className="flex w-full items-center justify-between my-3"+ variant="warning"+ >+ <WarningIcon />+ <div>+ <AlertTitle_Shadcn_>OTP expiry exceeds recommended threshold</AlertTitle_Shadcn_>+ <AlertDescription_Shadcn_ className="flex flex-col gap-y-3">+ <p>+ We have detected that you have enabled the email provider with the OTP expiry+ set to more than an hour. It is recommended to set this value to less than an+ hour.+ </p>+ <Button asChild type="default" className="w-min" icon={<ExternalLink />}>+ <Link href="https://supabase.com/docs/guides/platform/going-into-prod#security">+ View security recommendations+ </Link>+ </Button>+ </AlertDescription_Shadcn_></div>- ))}- {isSuccess &&- PROVIDERS_SCHEMAS.map((provider) => {- const providerSchema =- provider.title === 'Phone'- ? {- ...provider,- validationSchema: getPhoneProviderValidationSchema(authConfig),- }- : provider- let isActive = false- if (providerSchema.title === 'SAML 2.0') {- isActive = authConfig && (authConfig as any)['SAML_ENABLED']- } else if (providerSchema.title === 'LinkedIn (OIDC)') {- isActive = authConfig && (authConfig as any)['EXTERNAL_LINKEDIN_OIDC_ENABLED']- } else if (providerSchema.title === 'Slack (OIDC)') {- isActive = authConfig && (authConfig as any)['EXTERNAL_SLACK_OIDC_ENABLED']- } else if (providerSchema.title.includes('Web3')) {- isActive = authConfig && (authConfig as any)['EXTERNAL_WEB3_SOLANA_ENABLED']- } else {- isActive =- authConfig &&- (authConfig as any)[`EXTERNAL_${providerSchema.title.toUpperCase()}_ENABLED`]- }- return (- <ProviderForm- key={`provider_${providerSchema.title}`}- config={authConfig!}- provider={providerSchema as unknown as Provider}- isActive={isActive}- />- )- })}- </ResourceList>- </div>- )}- </ScaffoldSection>+ </Alert_Shadcn_>+ )}++ <ResourceList>+ {isLoading &&+ PROVIDERS_SCHEMAS.map((provider) => (+ <div+ key={`provider_${provider.title}`}+ className="py-4 px-6 border-b last:border-b-none"+ >+ <HorizontalShimmerWithIcon />+ </div>+ ))}+ {isSuccess &&+ PROVIDERS_SCHEMAS.map((provider) => {+ const providerSchema =+ provider.title === 'Phone'+ ? {+ ...provider,+ validationSchema: getPhoneProviderValidationSchema(authConfig),+ }+ : provider+ let isActive = false+ if (providerSchema.title === 'SAML 2.0') {+ isActive = authConfig && (authConfig as any)['SAML_ENABLED']+ } else if (providerSchema.title === 'LinkedIn (OIDC)') {+ isActive = authConfig && (authConfig as any)['EXTERNAL_LINKEDIN_OIDC_ENABLED']+ } else if (providerSchema.title === 'Slack (OIDC)') {+ isActive = authConfig && (authConfig as any)['EXTERNAL_SLACK_OIDC_ENABLED']+ } else if (providerSchema.title.includes('Web3')) {+ isActive = authConfig && (authConfig as any)['EXTERNAL_WEB3_SOLANA_ENABLED']+ } else {+ isActive =+ authConfig &&+ (authConfig as any)[`EXTERNAL_${providerSchema.title.toUpperCase()}_ENABLED`]+ }+ return (+ <ProviderForm+ key={`provider_${providerSchema.title}`}+ config={authConfig!}+ provider={providerSchema as unknown as Provider}+ isActive={isActive}+ />+ )+ })}+ </ResourceList>+ </div>+ )}+ </PageSectionContent>+ </PageSection>)}diff --git a/apps/studio/components/interfaces/Auth/BasicAuthSettingsForm.tsx b/apps/studio/components/interfaces/Auth/BasicAuthSettingsForm.tsxindex 4712b5f8914..d5de06cdf92 100644--- a/apps/studio/components/interfaces/Auth/BasicAuthSettingsForm.tsx+++ b/apps/studio/components/interfaces/Auth/BasicAuthSettingsForm.tsx@@ -8,7 +8,6 @@ import { toast } from 'sonner'import { boolean, object, string } from 'yup'import { useParams } from 'common'-import { ScaffoldSection, ScaffoldSectionTitle } from 'components/layouts/Scaffold'import AlertError from 'components/ui/AlertError'import { InlineLink } from 'components/ui/InlineLink'import NoPermission from 'components/ui/NoPermission'@@ -32,6 +31,13 @@ import {WarningIcon,} from 'ui'import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'+import {+ PageSection,+ PageSectionContent,+ PageSectionMeta,+ PageSectionSummary,+ PageSectionTitle,+} from 'ui-patterns/PageSection'import ShimmeringLoader from 'ui-patterns/ShimmeringLoader'import { NO_REQUIRED_CHARACTERS } from './Auth.constants'@@ -114,82 +120,119 @@ export const BasicAuthSettingsForm = () => {}return (- <ScaffoldSection isFullWidth>- <ScaffoldSectionTitle className="mb-4">User Signups</ScaffoldSectionTitle>-- {isError && (- <AlertError- error={authConfigError}- subject="Failed to retrieve auth configuration for hooks"- />- )}+ <PageSection>+ <PageSectionMeta>+ <PageSectionSummary>+ <PageSectionTitle>User Signups</PageSectionTitle>+ </PageSectionSummary>+ </PageSectionMeta>+ <PageSectionContent>+ {isError && (+ <AlertError+ error={authConfigError}+ subject="Failed to retrieve auth configuration for hooks"+ />+ )}- {isPermissionsLoaded && !canReadConfig && (- <div className="mt-8">- <NoPermission resourceText="view auth configuration settings" />- </div>- )}+ {isPermissionsLoaded && !canReadConfig && (+ <div className="mt-8">+ <NoPermission resourceText="view auth configuration settings" />+ </div>+ )}- {isLoading && (- <Card>- <CardContent className="py-6">- <ShimmeringLoader />- </CardContent>- <CardContent className="py-6">- <ShimmeringLoader />- </CardContent>- <CardContent className="py-6">- <ShimmeringLoader />- </CardContent>- <CardContent className="py-7">- <ShimmeringLoader />- </CardContent>- <CardContent className="py-7"></CardContent>- </Card>- )}+ {isLoading && (+ <Card>+ <CardContent className="py-6">+ <ShimmeringLoader />+ </CardContent>+ <CardContent className="py-6">+ <ShimmeringLoader />+ </CardContent>+ <CardContent className="py-6">+ <ShimmeringLoader />+ </CardContent>+ <CardContent className="py-7">+ <ShimmeringLoader />+ </CardContent>+ <CardContent className="py-7"></CardContent>+ </Card>+ )}- {isSuccess && (- <Form_Shadcn_ {...form}>- <form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">- <Card>- <CardContent>- <FormField_Shadcn_- control={form.control}- name="DISABLE_SIGNUP"- render={({ field }) => (- <FormItemLayout- layout="flex-row-reverse"- label="Allow new users to sign up"- description="If this is disabled, new users will not be able to sign up to your application"- >- <FormControl_Shadcn_>- <Switch- checked={field.value}- onCheckedChange={field.onChange}- disabled={!canUpdateConfig}- />- </FormControl_Shadcn_>- </FormItemLayout>- )}- />- </CardContent>- {showManualLinking && (+ {isSuccess && (+ <Form_Shadcn_ {...form}>+ <form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">+ <Card><CardContent><FormField_Shadcn_control={form.control}- name="SECURITY_MANUAL_LINKING_ENABLED"+ name="DISABLE_SIGNUP"render={({ field }) => (<FormItemLayoutlayout="flex-row-reverse"- label="Allow manual linking"+ label="Allow new users to sign up"+ description="If this is disabled, new users will not be able to sign up to your application"+ >+ <FormControl_Shadcn_>+ <Switch+ checked={field.value}+ onCheckedChange={field.onChange}+ disabled={!canUpdateConfig}+ />+ </FormControl_Shadcn_>+ </FormItemLayout>+ )}+ />+ </CardContent>+ {showManualLinking && (+ <CardContent>+ <FormField_Shadcn_+ control={form.control}+ name="SECURITY_MANUAL_LINKING_ENABLED"+ render={({ field }) => (+ <FormItemLayout+ layout="flex-row-reverse"+ label="Allow manual linking"+ description={+ <>+ Enable{' '}+ <InlineLink+ className="text-foreground-light hover:text-foreground"+ href={`${DOCS_URL}/guides/auth/auth-identity-linking#manual-linking-beta`}+ >+ manual linking APIs+ </InlineLink>{' '}+ for your project+ </>+ }+ >+ <FormControl_Shadcn_>+ <Switch+ checked={field.value}+ onCheckedChange={field.onChange}+ disabled={!canUpdateConfig}+ />+ </FormControl_Shadcn_>+ </FormItemLayout>+ )}+ />+ </CardContent>+ )}+ <CardContent>+ <FormField_Shadcn_+ control={form.control}+ name="EXTERNAL_ANONYMOUS_USERS_ENABLED"+ render={({ field }) => (+ <FormItemLayout+ layout="flex-row-reverse"+ label="Allow anonymous sign-ins"description={<>Enable{' '}<InlineLinkclassName="text-foreground-light hover:text-foreground"- href={`${DOCS_URL}/guides/auth/auth-identity-linking#manual-linking-beta`}+ href={`${DOCS_URL}/guides/auth/auth-anonymous`}>- manual linking APIs+ anonymous sign-ins</InlineLink>{' '}for your project</>@@ -205,133 +248,102 @@ export const BasicAuthSettingsForm = () => {</FormItemLayout>)}/>- </CardContent>- )}- <CardContent>- <FormField_Shadcn_- control={form.control}- name="EXTERNAL_ANONYMOUS_USERS_ENABLED"- render={({ field }) => (- <FormItemLayout- layout="flex-row-reverse"- label="Allow anonymous sign-ins"- description={- <>- Enable{' '}- <InlineLink- className="text-foreground-light hover:text-foreground"- href={`${DOCS_URL}/guides/auth/auth-anonymous`}- >- anonymous sign-ins- </InlineLink>{' '}- for your project- </>- }- >- <FormControl_Shadcn_>- <Switch- checked={field.value}- onCheckedChange={field.onChange}- disabled={!canUpdateConfig}- />- </FormControl_Shadcn_>- </FormItemLayout>- )}- />- {form.watch('EXTERNAL_ANONYMOUS_USERS_ENABLED') && (- <Alert_Shadcn_- className="flex w-full items-center justify-between mt-4"- variant="warning"- >- <WarningIcon />- <div>- <AlertTitle_Shadcn_>- Anonymous users will use the{' '}- <code className="text-code-inline">authenticated</code> role when signing in- </AlertTitle_Shadcn_>- <AlertDescription_Shadcn_ className="flex flex-col gap-y-3">- <p>- As a result, anonymous users will be subjected to RLS policies that apply- to the <code className="text-code-inline">public</code> and{' '}- <code className="text-code-inline">authenticated</code> roles. We strongly- advise{' '}- <Link- href={`/project/${projectRef}/auth/policies`}- className="text-foreground underline"- >- reviewing your RLS policies- </Link>{' '}- to ensure that access to your data is restricted where required.- </p>- <Button asChild type="default" className="w-min" icon={<ExternalLink />}>- <Link href={`${DOCS_URL}/guides/auth/auth-anonymous#access-control`}>- View access control docs- </Link>- </Button>- </AlertDescription_Shadcn_>- </div>- </Alert_Shadcn_>- )}-- {!authConfig?.SECURITY_CAPTCHA_ENABLED &&- form.watch('EXTERNAL_ANONYMOUS_USERS_ENABLED') && (- <Alert_Shadcn_ className="mt-4">+ {form.watch('EXTERNAL_ANONYMOUS_USERS_ENABLED') && (+ <Alert_Shadcn_+ className="flex w-full items-center justify-between mt-4"+ variant="warning"+ ><WarningIcon />- <AlertTitle_Shadcn_>- We highly recommend{' '}- <InlineLink href={`/project/${projectRef}/auth/protection`}>- enabling captcha- </InlineLink>{' '}- for anonymous sign-ins- </AlertTitle_Shadcn_>- <AlertDescription_Shadcn_>- This will prevent potential abuse on sign-ins which may bloat your database- and incur costs for monthly active users (MAU)- </AlertDescription_Shadcn_>+ <div>+ <AlertTitle_Shadcn_>+ Anonymous users will use the{' '}+ <code className="text-code-inline">authenticated</code> role when signing+ in+ </AlertTitle_Shadcn_>+ <AlertDescription_Shadcn_ className="flex flex-col gap-y-3">+ <p>+ As a result, anonymous users will be subjected to RLS policies that+ apply to the <code className="text-code-inline">public</code> and{' '}+ <code className="text-code-inline">authenticated</code> roles. We+ strongly advise{' '}+ <Link+ href={`/project/${projectRef}/auth/policies`}+ className="text-foreground underline"+ >+ reviewing your RLS policies+ </Link>{' '}+ to ensure that access to your data is restricted where required.+ </p>+ <Button asChild type="default" className="w-min" icon={<ExternalLink />}>+ <Link href={`${DOCS_URL}/guides/auth/auth-anonymous#access-control`}>+ View access control docs+ </Link>+ </Button>+ </AlertDescription_Shadcn_>+ </div></Alert_Shadcn_>)}- </CardContent>- <CardContent>- <FormField_Shadcn_- control={form.control}- name="MAILER_AUTOCONFIRM"- render={({ field }) => (- <FormItemLayout- layout="flex-row-reverse"- label="Confirm email"- description="Users will need to confirm their email address before signing in for the first time"- >- <FormControl_Shadcn_>- <Switch- checked={field.value}- onCheckedChange={field.onChange}- disabled={!canUpdateConfig}- />- </FormControl_Shadcn_>- </FormItemLayout>++ {!authConfig?.SECURITY_CAPTCHA_ENABLED &&+ form.watch('EXTERNAL_ANONYMOUS_USERS_ENABLED') && (+ <Alert_Shadcn_ className="mt-4">+ <WarningIcon />+ <AlertTitle_Shadcn_>+ We highly recommend{' '}+ <InlineLink href={`/project/${projectRef}/auth/protection`}>+ enabling captcha+ </InlineLink>{' '}+ for anonymous sign-ins+ </AlertTitle_Shadcn_>+ <AlertDescription_Shadcn_>+ This will prevent potential abuse on sign-ins which may bloat your+ database and incur costs for monthly active users (MAU)+ </AlertDescription_Shadcn_>+ </Alert_Shadcn_>+ )}+ </CardContent>+ <CardContent>+ <FormField_Shadcn_+ control={form.control}+ name="MAILER_AUTOCONFIRM"+ render={({ field }) => (+ <FormItemLayout+ layout="flex-row-reverse"+ label="Confirm email"+ description="Users will need to confirm their email address before signing in for the first time"+ >+ <FormControl_Shadcn_>+ <Switch+ checked={field.value}+ onCheckedChange={field.onChange}+ disabled={!canUpdateConfig}+ />+ </FormControl_Shadcn_>+ </FormItemLayout>+ )}+ />+ </CardContent>+ <CardFooter className="justify-end space-x-2">+ {form.formState.isDirty && (+ <Button type="default" onClick={() => form.reset()}>+ Cancel+ </Button>)}- />- </CardContent>- <CardFooter className="justify-end space-x-2">- {form.formState.isDirty && (- <Button type="default" onClick={() => form.reset()}>- Cancel+ <Button+ type="primary"+ htmlType="submit"+ disabled={!canUpdateConfig || isUpdatingConfig || !form.formState.isDirty}+ loading={isUpdatingConfig}+ >+ Save changes</Button>- )}- <Button- type="primary"- htmlType="submit"- disabled={!canUpdateConfig || isUpdatingConfig || !form.formState.isDirty}- loading={isUpdatingConfig}- >- Save changes- </Button>- </CardFooter>- </Card>- </form>- </Form_Shadcn_>- )}- </ScaffoldSection>+ </CardFooter>+ </Card>+ </form>+ </Form_Shadcn_>+ )}+ </PageSectionContent>+ </PageSection>)}diff --git a/apps/studio/components/interfaces/Auth/EmailTemplates/EmailTemplates.tsx b/apps/studio/components/interfaces/Auth/EmailTemplates/EmailTemplates.tsxindex d64d70e5de2..bc91aea9a9a 100644--- a/apps/studio/components/interfaces/Auth/EmailTemplates/EmailTemplates.tsx+++ b/apps/studio/components/interfaces/Auth/EmailTemplates/EmailTemplates.tsx@@ -10,7 +10,6 @@ import { z } from 'zod'import { LOCAL_STORAGE_KEYS, useParams } from 'common'import { FEATURE_PREVIEWS } from 'components/interfaces/App/FeaturePreview/FeaturePreview.constants'import { useIsSecurityNotificationsEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'-import { ScaffoldSection, ScaffoldSectionTitle } from 'components/layouts/Scaffold'import AlertError from 'components/ui/AlertError'import { InlineLink } from 'components/ui/InlineLink'import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'@@ -38,6 +37,13 @@ import {TooltipTrigger,} from 'ui'import { Admonition } from 'ui-patterns'+import {+ PageSection,+ PageSectionContent,+ PageSectionMeta,+ PageSectionSummary,+ PageSectionTitle,+} from 'ui-patterns/PageSection'import { TEMPLATES_SCHEMAS } from '../AuthTemplatesValidation'import { EmailRateLimitsAlert } from '../EmailRateLimitsAlert'import { slugifyTitle } from './EmailTemplates.utils'@@ -124,18 +130,26 @@ export const EmailTemplates = () => {}, [authConfig])return (- <ScaffoldSection isFullWidth className="!pt-0">+ <>{isError && (- <AlertError- className="mt-12"- error={authConfigError}- subject="Failed to retrieve auth configuration"- />+ <PageSection className="!pt-0">+ <PageSectionContent>+ <AlertError+ className="mt-12"+ error={authConfigError}+ subject="Failed to retrieve auth configuration"+ />+ </PageSectionContent>+ </PageSection>)}{isLoading && (- <div className="w-[854px] mt-12">- <GenericSkeletonLoader />- </div>+ <PageSection className="!pt-0">+ <PageSectionContent>+ <div className="w-[854px] mt-12">+ <GenericSkeletonLoader />+ </div>+ </PageSectionContent>+ </PageSection>)}{isSuccess && (<>@@ -145,200 +159,221 @@ export const EmailTemplates = () => {</div>) : null}{isSecurityNotificationsEnabled ? (- <div className="mt-12 space-y-12">- <div>- <ScaffoldSectionTitle className="mb-4">Authentication</ScaffoldSectionTitle>- <Card>- {TEMPLATES_SCHEMAS.filter(- (t) => t.misc?.emailTemplateType === 'authentication'- ).map((template) => {- const templateSlug = slugifyTitle(template.title)-- return (- <CardContent key={`${template.id}`} className="p-0">- <Link- href={`/project/${projectRef}/auth/templates/${templateSlug}`}- className="flex items-center justify-between hover:bg-surface-200 transition-colors py-4 px-6 w-full h-full"- >- <div className="flex flex-col">- <h3 className="text-sm text-foreground">{template.title}</h3>- {template.purpose && (- <p className="text-sm text-foreground-lighter">{template.purpose}</p>- )}- </div>-- <div className="flex items-center gap-4">- <ChevronRight size={16} className="text-foreground-muted" />- </div>- </Link>- </CardContent>- )- })}- </Card>- </div>-- <div>- <ScaffoldSectionTitle className="mb-4">Security</ScaffoldSectionTitle>- {!acknowledged && (- <Admonition showIcon={false} type="tip" className="relative mb-6">- <Tooltip>- <TooltipTrigger- onClick={() => setAcknowledged(true)}- className="absolute top-3 right-3 opacity-30 hover:opacity-100 transition-opacity"- >- <X size={14} className="text-foreground-light" />- </TooltipTrigger>- <TooltipContent side="bottom">Dismiss</TooltipContent>- </Tooltip>- <div className="flex flex-col md:flex-row md:items-center gap-y-2 md:gap-x-8 justify-between px-2 py-1">- <div className="flex flex-col gap-y-0.5">- <div className="flex flex-col gap-y-2 items-start">- <Badge variant="success" className="-ml-0.5 uppercase">- New- </Badge>- <p className="text-sm font-medium">- Notify users about security-sensitive actions on their accounts- </p>- </div>- <p className="text-sm text-foreground-lighter text-balance">- We’ve expanded our email templates to handle security-sensitive actions.- The list of templates will continue to grow as our feature-set changes- {SECURITY_NOTIFICATIONS_DISCUSSIONS_URL && (- <>- {' '}- and as we{' '}- <InlineLink- href={SECURITY_NOTIFICATIONS_DISCUSSIONS_URL}- target="_blank"- >- gather feedback- </InlineLink>{' '}- from our community- </>- )}- .- </p>- </div>- <Button- asChild- type="default"- icon={<ExternalLink strokeWidth={1.5} />}- className="mt-2"- >- <Link href={`${DOCS_URL}/guides/auth/auth-email-templates`} target="_blank">- Docs- </Link>- </Button>- </div>- </Admonition>- )}+ <>+ <PageSection className="!pt-0">+ <PageSectionMeta>+ <PageSectionSummary>+ <PageSectionTitle>Authentication</PageSectionTitle>+ </PageSectionSummary>+ </PageSectionMeta>+ <PageSectionContent>+ <Card>+ {TEMPLATES_SCHEMAS.filter(+ (t) => t.misc?.emailTemplateType === 'authentication'+ ).map((template) => {+ const templateSlug = slugifyTitle(template.title)- <Form_Shadcn_ {...notificationsForm}>- <form onSubmit={notificationsForm.handleSubmit(onSubmit)} className="space-y-4">- <Card>- {TEMPLATES_SCHEMAS.filter(- (t) => t.misc?.emailTemplateType === 'security'- ).map((template) => {- const templateSlug = slugifyTitle(template.title)- const templateEnabledKey =- `MAILER_NOTIFICATIONS_${template.id?.replace('_NOTIFICATION', '')}_ENABLED` as keyof typeof authConfig-- return (- <CardContent- key={`${template.id}`}- className="p-0 flex items-center justify-between hover:bg-surface-200 transition-colors w-full h-full"+ return (+ <CardContent key={`${template.id}`} className="p-0">+ <Link+ href={`/project/${projectRef}/auth/templates/${templateSlug}`}+ className="flex items-center justify-between hover:bg-surface-200 transition-colors py-4 px-6 w-full h-full">- <Link- href={`/project/${projectRef}/auth/templates/${templateSlug}`}- className="flex flex-col flex-1 py-4 px-6"- >+ <div className="flex flex-col"><h3 className="text-sm text-foreground">{template.title}</h3>{template.purpose && (<p className="text-sm text-foreground-lighter">{template.purpose}</p>)}- </Link>+ </div>- <div className="flex items-center gap-4 h-full pl-2 relative">- <FormField_Shadcn_- control={notificationsForm.control}- name={templateEnabledKey}- render={({ field }) => (- <FormControl_Shadcn_>- <Switch- checked={field.value}- onCheckedChange={field.onChange}- disabled={!canUpdateConfig}- />- </FormControl_Shadcn_>- )}- />+ <div className="flex items-center gap-4">+ <ChevronRight size={16} className="text-foreground-muted" />+ </div>+ </Link>+ </CardContent>+ )+ })}+ </Card>+ </PageSectionContent>+ </PageSection>+ <PageSection>+ <PageSectionMeta>+ <PageSectionSummary>+ <PageSectionTitle>Security</PageSectionTitle>+ </PageSectionSummary>+ </PageSectionMeta>+ <PageSectionContent>+ {!acknowledged && (+ <Admonition showIcon={false} type="tip" className="relative mb-6">+ <Tooltip>+ <TooltipTrigger+ onClick={() => setAcknowledged(true)}+ className="absolute top-3 right-3 opacity-30 hover:opacity-100 transition-opacity"+ >+ <X size={14} className="text-foreground-light" />+ </TooltipTrigger>+ <TooltipContent side="bottom">Dismiss</TooltipContent>+ </Tooltip>+ <div className="flex flex-col md:flex-row md:items-center gap-y-2 md:gap-x-8 justify-between px-2 py-1">+ <div className="flex flex-col gap-y-0.5">+ <div className="flex flex-col gap-y-2 items-start">+ <Badge variant="success" className="-ml-0.5 uppercase">+ New+ </Badge>+ <p className="text-sm font-medium">+ Notify users about security-sensitive actions on their accounts+ </p>+ </div>+ <p className="text-sm text-foreground-lighter text-balance">+ We’ve expanded our email templates to handle security-sensitive actions.+ The list of templates will continue to grow as our feature-set changes+ {SECURITY_NOTIFICATIONS_DISCUSSIONS_URL && (+ <>+ {' '}+ and as we{' '}+ <InlineLink+ href={SECURITY_NOTIFICATIONS_DISCUSSIONS_URL}+ target="_blank"+ >+ gather feedback+ </InlineLink>{' '}+ from our community+ </>+ )}+ .+ </p>+ </div>+ <Button+ asChild+ type="default"+ icon={<ExternalLink strokeWidth={1.5} />}+ className="mt-2"+ >+ <Link+ href={`${DOCS_URL}/guides/auth/auth-email-templates`}+ target="_blank"+ >+ Docs+ </Link>+ </Button>+ </div>+ </Admonition>+ )}++ <Form_Shadcn_ {...notificationsForm}>+ <form onSubmit={notificationsForm.handleSubmit(onSubmit)} className="space-y-4">+ <Card>+ {TEMPLATES_SCHEMAS.filter(+ (t) => t.misc?.emailTemplateType === 'security'+ ).map((template) => {+ const templateSlug = slugifyTitle(template.title)+ const templateEnabledKey =+ `MAILER_NOTIFICATIONS_${template.id?.replace('_NOTIFICATION', '')}_ENABLED` as keyof typeof authConfig++ return (+ <CardContent+ key={`${template.id}`}+ className="p-0 flex items-center justify-between hover:bg-surface-200 transition-colors w-full h-full"+ ><Linkhref={`/project/${projectRef}/auth/templates/${templateSlug}`}- className="py-6 pr-6"+ className="flex flex-col flex-1 py-4 px-6">- <ChevronRight size={16} className="text-foreground-muted" />+ <h3 className="text-sm text-foreground">{template.title}</h3>+ {template.purpose && (+ <p className="text-sm text-foreground-lighter">+ {template.purpose}+ </p>+ )}</Link>- </div>- </CardContent>- )- })}- <CardFooter className="justify-end space-x-2">- {notificationsForm.formState.isDirty && (- <Button type="default" onClick={() => notificationsForm.reset()}>- Cancel++ <div className="flex items-center gap-4 h-full pl-2 relative">+ <FormField_Shadcn_+ control={notificationsForm.control}+ name={templateEnabledKey}+ render={({ field }) => (+ <FormControl_Shadcn_>+ <Switch+ checked={field.value}+ onCheckedChange={field.onChange}+ disabled={!canUpdateConfig}+ />+ </FormControl_Shadcn_>+ )}+ />++ <Link+ href={`/project/${projectRef}/auth/templates/${templateSlug}`}+ className="py-6 pr-6"+ >+ <ChevronRight size={16} className="text-foreground-muted" />+ </Link>+ </div>+ </CardContent>+ )+ })}+ <CardFooter className="justify-end space-x-2">+ {notificationsForm.formState.isDirty && (+ <Button type="default" onClick={() => notificationsForm.reset()}>+ Cancel+ </Button>+ )}+ <Button+ type="primary"+ htmlType="submit"+ disabled={+ !canUpdateConfig ||+ isUpdatingConfig ||+ !notificationsForm.formState.isDirty+ }+ loading={isUpdatingConfig}+ >+ Save changes</Button>- )}- <Button- type="primary"- htmlType="submit"- disabled={- !canUpdateConfig ||- isUpdatingConfig ||- !notificationsForm.formState.isDirty- }- loading={isUpdatingConfig}- >- Save changes- </Button>- </CardFooter>- </Card>- </form>- </Form_Shadcn_>- </div>- </div>+ </CardFooter>+ </Card>+ </form>+ </Form_Shadcn_>+ </PageSectionContent>+ </PageSection>+ </>) : (- <Card className="mt-12">- <Tabs_Shadcn_ defaultValue={slugifyTitle(TEMPLATES_SCHEMAS[0].title)}>- <TabsList_Shadcn_ className="pt-2 px-6 gap-5 mb-0 overflow-x-scroll no-scrollbar mb-4">- {TEMPLATES_SCHEMAS.filter(- (t) => t.misc?.emailTemplateType === 'authentication'- ).map((template) => (- <TabsTrigger_Shadcn_- key={`${template.id}`}- value={slugifyTitle(template.title)}- >- {template.title}- </TabsTrigger_Shadcn_>- ))}- </TabsList_Shadcn_>- {TEMPLATES_SCHEMAS.filter(- (t) => t.misc?.emailTemplateType === 'authentication'- ).map((template) => {- const panelId = slugifyTitle(template.title)- return (- <TabsContent_Shadcn_ key={panelId} value={panelId} className="mt-0">- <TemplateEditor key={template.title} template={template} />- </TabsContent_Shadcn_>- )- })}- </Tabs_Shadcn_>- </Card>+ <PageSection className="!pt-0">+ <PageSectionContent>+ <Card className="mt-12">+ <Tabs_Shadcn_ defaultValue={slugifyTitle(TEMPLATES_SCHEMAS[0].title)}>+ <TabsList_Shadcn_ className="pt-2 px-6 gap-5 mb-0 overflow-x-scroll no-scrollbar mb-4">+ {TEMPLATES_SCHEMAS.filter(+ (t) => t.misc?.emailTemplateType === 'authentication'+ ).map((template) => (+ <TabsTrigger_Shadcn_+ key={`${template.id}`}+ value={slugifyTitle(template.title)}+ >+ {template.title}+ </TabsTrigger_Shadcn_>+ ))}+ </TabsList_Shadcn_>+ {TEMPLATES_SCHEMAS.filter(+ (t) => t.misc?.emailTemplateType === 'authentication'+ ).map((template) => {+ const panelId = slugifyTitle(template.title)+ return (+ <TabsContent_Shadcn_ key={panelId} value={panelId} className="mt-0">+ <TemplateEditor key={template.title} template={template} />+ </TabsContent_Shadcn_>+ )+ })}+ </Tabs_Shadcn_>+ </Card>+ </PageSectionContent>+ </PageSection>)}</>)}- </ScaffoldSection>+ </>)}diff --git a/apps/studio/components/interfaces/Auth/Hooks/HooksListing.tsx b/apps/studio/components/interfaces/Auth/Hooks/HooksListing.tsxindex cdc156ea283..361b012f75e 100644--- a/apps/studio/components/interfaces/Auth/Hooks/HooksListing.tsx+++ b/apps/studio/components/interfaces/Auth/Hooks/HooksListing.tsx@@ -2,7 +2,6 @@ import { useState } from 'react'import { toast } from 'sonner'import { useParams } from 'common'-import { ScaffoldSection, ScaffoldSectionTitle } from 'components/layouts/Scaffold'import AlertError from 'components/ui/AlertError'import CodeEditor from 'components/ui/CodeEditor/CodeEditor'import { useAuthConfigQuery } from 'data/auth/auth-config-query'@@ -13,6 +12,14 @@ import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'import { cn } from 'ui'import { GenericSkeletonLoader } from 'ui-patterns'import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal'+import {+ PageSection,+ PageSectionAside,+ PageSectionContent,+ PageSectionMeta,+ PageSectionSummary,+ PageSectionTitle,+} from 'ui-patterns/PageSection'import { AddHookDropdown } from './AddHookDropdown'import { CreateHookSheet } from './CreateHookSheet'import { HookCard } from './HookCard'@@ -77,126 +84,135 @@ export const HooksListing = () => {if (isError) {return (- <ScaffoldSection isFullWidth>- <AlertError- error={authConfigError}- subject="Failed to retrieve auth configuration for hooks"- />- </ScaffoldSection>+ <PageSection>+ <PageSectionContent>+ <AlertError+ error={authConfigError}+ subject="Failed to retrieve auth configuration for hooks"+ />+ </PageSectionContent>+ </PageSection>)}if (isLoading) {return (- <ScaffoldSection isFullWidth>- <GenericSkeletonLoader />- </ScaffoldSection>+ <PageSection>+ <PageSectionContent>+ <GenericSkeletonLoader />+ </PageSectionContent>+ </PageSection>)}return (- <ScaffoldSection isFullWidth>- <div className="flex justify-between items-center mb-4">- <ScaffoldSectionTitle>All hooks</ScaffoldSectionTitle>- <AddHookDropdown- onSelectHook={(title) => {- const hook = hooks.find((h) => h.title === title)- if (hook) setSelectedHook(hook.id)- }}- />- </div>-- {hooks.filter((h) => isValidHook(h)).length === 0 && (- <div- className={[- 'border rounded border-default px-20 py-16',- 'flex flex-col items-center justify-center space-y-4',- ].join(' ')}- >- <p className="text-sm text-foreground-light">No hooks configured yet</p>+ <PageSection>+ <PageSectionMeta>+ <PageSectionSummary>+ <PageSectionTitle>All hooks</PageSectionTitle>+ </PageSectionSummary>+ <PageSectionAside><AddHookDropdown- align="center"- buttonText="Add a new hook"onSelectHook={(title) => {const hook = hooks.find((h) => h.title === title)if (hook) setSelectedHook(hook.id)}}/>- </div>- )}-- <div className="-space-y-px">- {hooks- .filter((h) => isValidHook(h))- .map((hook) => {- return (- <HookCard- key={hook.enabledKey}- hook={hook}- onSelect={() => setSelectedHook(hook.id)}- />- )- })}- </div>+ </PageSectionAside>+ </PageSectionMeta>+ <PageSectionContent>+ {hooks.filter((h) => isValidHook(h)).length === 0 && (+ <div+ className={[+ 'border rounded border-default px-20 py-16',+ 'flex flex-col items-center justify-center space-y-4',+ ].join(' ')}+ >+ <p className="text-sm text-foreground-light">No hooks configured yet</p>+ <AddHookDropdown+ align="center"+ buttonText="Add a new hook"+ onSelectHook={(title) => {+ const hook = hooks.find((h) => h.title === title)+ if (hook) setSelectedHook(hook.id)+ }}+ />+ </div>+ )}- <CreateHookSheet- title={selectedHook ?? null}- visible={!!selectedHook}- onDelete={() => {- const hook = hooks.find((h) => h.title === selectedHook)- if (hook) setSelectedHookForDeletion(hook)- }}- onClose={() => setSelectedHook(null)}- authConfig={authConfig!}- />-- <ConfirmationModal- visible={!!selectedHookForDeletion}- size="large"- variant="destructive"- loading={isDeletingAuthHook}- title={`Confirm to delete ${selectedHookForDeletion?.title}`}- confirmLabel="Delete"- confirmLabelLoading="Deleting"- onCancel={() => setSelectedHookForDeletion(null)}- onConfirm={() => {- if (!selectedHookForDeletion) return- updateAuthHooks({- projectRef: projectRef!,- config: {- [selectedHookForDeletion.enabledKey]: false,- [selectedHookForDeletion.uriKey]: null,- [selectedHookForDeletion.secretsKey]: null,- },- })- }}- >- <div>- <p className="text-sm text-foreground-light">- Are you sure you want to delete the {selectedHookForDeletion?.title}?- </p>- {selectedHookForDeletion?.method.type === 'postgres' && (- <>- <p className="text-sm text-foreground-light">- The following statements will be executed on the{' '}- {selectedHookForDeletion?.method.schema}.- {selectedHookForDeletion?.method.functionName} function:- </p>- <div className={cn('mt-4', 'h-72')}>- <CodeEditor- id="deletion-hook-editor"- isReadOnly={true}- language="pgsql"- value={getRevokePermissionStatements(- selectedHookForDeletion?.method.schema,- selectedHookForDeletion?.method.functionName- ).join('\n\n')}+ <div className="-space-y-px">+ {hooks+ .filter((h) => isValidHook(h))+ .map((hook) => {+ return (+ <HookCard+ key={hook.enabledKey}+ hook={hook}+ onSelect={() => setSelectedHook(hook.id)}/>- </div>- </>- )}+ )+ })}</div>- </ConfirmationModal>- </ScaffoldSection>++ <CreateHookSheet+ title={selectedHook ?? null}+ visible={!!selectedHook}+ onDelete={() => {+ const hook = hooks.find((h) => h.title === selectedHook)+ if (hook) setSelectedHookForDeletion(hook)+ }}+ onClose={() => setSelectedHook(null)}+ authConfig={authConfig!}+ />++ <ConfirmationModal+ visible={!!selectedHookForDeletion}+ size="large"+ variant="destructive"+ loading={isDeletingAuthHook}+ title={`Confirm to delete ${selectedHookForDeletion?.title}`}+ confirmLabel="Delete"+ confirmLabelLoading="Deleting"+ onCancel={() => setSelectedHookForDeletion(null)}+ onConfirm={() => {+ if (!selectedHookForDeletion) return+ updateAuthHooks({+ projectRef: projectRef!,+ config: {+ [selectedHookForDeletion.enabledKey]: false,+ [selectedHookForDeletion.uriKey]: null,+ [selectedHookForDeletion.secretsKey]: null,+ },+ })+ }}+ >+ <div>+ <p className="text-sm text-foreground-light">+ Are you sure you want to delete the {selectedHookForDeletion?.title}?+ </p>+ {selectedHookForDeletion?.method.type === 'postgres' && (+ <>+ <p className="text-sm text-foreground-light">+ The following statements will be executed on the{' '}+ {selectedHookForDeletion?.method.schema}.+ {selectedHookForDeletion?.method.functionName} function:+ </p>+ <div className={cn('mt-4', 'h-72')}>+ <CodeEditor+ id="deletion-hook-editor"+ isReadOnly={true}+ language="pgsql"+ value={getRevokePermissionStatements(+ selectedHookForDeletion?.method.schema,+ selectedHookForDeletion?.method.functionName+ ).join('\n\n')}+ />+ </div>+ </>+ )}+ </div>+ </ConfirmationModal>+ </PageSectionContent>+ </PageSection>)}diff --git a/apps/studio/components/interfaces/Auth/MfaAuthSettingsForm/MfaAuthSettingsForm.tsx b/apps/studio/components/interfaces/Auth/MfaAuthSettingsForm/MfaAuthSettingsForm.tsxindex 1f5cb248e5b..370ae1b2699 100644--- a/apps/studio/components/interfaces/Auth/MfaAuthSettingsForm/MfaAuthSettingsForm.tsx+++ b/apps/studio/components/interfaces/Auth/MfaAuthSettingsForm/MfaAuthSettingsForm.tsx@@ -6,7 +6,6 @@ import { toast } from 'sonner'import { boolean, number, object, string } from 'yup'import { useParams } from 'common'-import { ScaffoldSection, ScaffoldSectionTitle } from 'components/layouts/Scaffold'import AlertError from 'components/ui/AlertError'import NoPermission from 'components/ui/NoPermission'import UpgradeToPro from 'components/ui/UpgradeToPro'@@ -38,6 +37,13 @@ import {import { GenericSkeletonLoader } from 'ui-patterns'import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal'import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'+import {+ PageSection,+ PageSectionContent,+ PageSectionMeta,+ PageSectionSummary,+ PageSectionTitle,+} from 'ui-patterns/PageSection'function determineMFAStatus(verifyEnabled: boolean, enrollEnabled: boolean) {return verifyEnabled ? (enrollEnabled ? 'Enabled' : 'Verify Enabled') : 'Disabled'@@ -259,25 +265,31 @@ export const MfaAuthSettingsForm = () => {if (isError) {return (- <ScaffoldSection isFullWidth>- <AlertError error={authConfigError} subject="Failed to retrieve auth configuration" />- </ScaffoldSection>+ <PageSection>+ <PageSectionContent>+ <AlertError error={authConfigError} subject="Failed to retrieve auth configuration" />+ </PageSectionContent>+ </PageSection>)}if (!canReadConfig) {return (- <ScaffoldSection isFullWidth>- <NoPermission resourceText="view auth configuration settings" />- </ScaffoldSection>+ <PageSection>+ <PageSectionContent>+ <NoPermission resourceText="view auth configuration settings" />+ </PageSectionContent>+ </PageSection>)}if (isLoading) {return (- <ScaffoldSection isFullWidth>- <GenericSkeletonLoader />- </ScaffoldSection>+ <PageSection>+ <PageSectionContent>+ <GenericSkeletonLoader />+ </PageSectionContent>+ </PageSection>)}@@ -296,226 +308,234 @@ export const MfaAuthSettingsForm = () => {return (<>- <ScaffoldSection isFullWidth>- <ScaffoldSectionTitle className="mb-4">- Multi-Factor Authentication (MFA)- </ScaffoldSectionTitle>-- <Form_Shadcn_ {...totpForm}>- <form onSubmit={totpForm.handleSubmit(onSubmitTotpForm)} className="space-y-4">- <Card>- <CardContent className="pt-6">- <FormField_Shadcn_- control={totpForm.control}- name="MFA_TOTP"- render={({ field }) => (- <FormItemLayout- layout="flex-row-reverse"- label="TOTP (App Authenticator)"- description="Control use of TOTP (App Authenticator) factors"- >- <FormControl_Shadcn_>- <Select_Shadcn_- value={field.value}- onValueChange={field.onChange}- disabled={!canUpdateConfig}- >- <SelectTrigger_Shadcn_>- <SelectValue_Shadcn_ placeholder="Select status" />- </SelectTrigger_Shadcn_>- <SelectContent_Shadcn_>- {MFAFactorSelectionOptions.map((option) => (- <SelectItem_Shadcn_ key={option.value} value={option.value}>- {option.label}- </SelectItem_Shadcn_>- ))}- </SelectContent_Shadcn_>- </Select_Shadcn_>- </FormControl_Shadcn_>- </FormItemLayout>+ <PageSection>+ <PageSectionMeta>+ <PageSectionSummary>+ <PageSectionTitle>Multi-Factor Authentication (MFA)</PageSectionTitle>+ </PageSectionSummary>+ </PageSectionMeta>+ <PageSectionContent>+ <Form_Shadcn_ {...totpForm}>+ <form onSubmit={totpForm.handleSubmit(onSubmitTotpForm)} className="space-y-4">+ <Card>+ <CardContent className="pt-6">+ <FormField_Shadcn_+ control={totpForm.control}+ name="MFA_TOTP"+ render={({ field }) => (+ <FormItemLayout+ layout="flex-row-reverse"+ label="TOTP (App Authenticator)"+ description="Control use of TOTP (App Authenticator) factors"+ >+ <FormControl_Shadcn_>+ <Select_Shadcn_+ value={field.value}+ onValueChange={field.onChange}+ disabled={!canUpdateConfig}+ >+ <SelectTrigger_Shadcn_>+ <SelectValue_Shadcn_ placeholder="Select status" />+ </SelectTrigger_Shadcn_>+ <SelectContent_Shadcn_>+ {MFAFactorSelectionOptions.map((option) => (+ <SelectItem_Shadcn_ key={option.value} value={option.value}>+ {option.label}+ </SelectItem_Shadcn_>+ ))}+ </SelectContent_Shadcn_>+ </Select_Shadcn_>+ </FormControl_Shadcn_>+ </FormItemLayout>+ )}+ />+ </CardContent>++ <CardContent>+ <FormField_Shadcn_+ control={totpForm.control}+ name="MFA_MAX_ENROLLED_FACTORS"+ render={({ field }) => (+ <FormItemLayout+ layout="flex-row-reverse"+ label="Maximum number of per-user MFA factors"+ description="How many MFA factors can be enrolled at once per user."+ >+ <FormControl_Shadcn_>+ <PrePostTab postTab="factors">+ <Input_Shadcn_+ type="number"+ min={0}+ max={30}+ {...field}+ disabled={!canUpdateConfig}+ />+ </PrePostTab>+ </FormControl_Shadcn_>+ </FormItemLayout>+ )}+ />+ </CardContent>++ <CardFooter className="justify-end space-x-2">+ {totpForm.formState.isDirty && (+ <Button type="default" onClick={() => totpForm.reset()}>+ Cancel+ </Button>)}- />- </CardContent>-- <CardContent>- <FormField_Shadcn_- control={totpForm.control}- name="MFA_MAX_ENROLLED_FACTORS"- render={({ field }) => (- <FormItemLayout- layout="flex-row-reverse"- label="Maximum number of per-user MFA factors"- description="How many MFA factors can be enrolled at once per user."- >- <FormControl_Shadcn_>- <PrePostTab postTab="factors">+ <Button+ type="primary"+ htmlType="submit"+ disabled={!canUpdateConfig || isUpdatingTotpForm || !totpForm.formState.isDirty}+ loading={isUpdatingTotpForm}+ >+ Save changes+ </Button>+ </CardFooter>+ </Card>+ </form>+ </Form_Shadcn_>+ </PageSectionContent>+ </PageSection>++ <PageSection>+ <PageSectionMeta>+ <PageSectionSummary>+ <PageSectionTitle>SMS MFA</PageSectionTitle>+ </PageSectionSummary>+ </PageSectionMeta>+ <PageSectionContent>+ <Form_Shadcn_ {...phoneForm}>+ <form+ onSubmit={(e) => {+ e.preventDefault()+ maybeConfirmPhoneMFAOrSubmit()+ }}+ className="space-y-4"+ >+ <Card>+ <CardContent className="pt-6">+ {promptProPlanUpgrade && (+ <div className="mb-4">+ <UpgradeToPro+ primaryText="Upgrade to Pro"+ secondaryText="Advanced MFA requires the Pro Plan"+ />+ </div>+ )}++ <FormField_Shadcn_+ control={phoneForm.control}+ name="MFA_PHONE"+ render={({ field }) => (+ <FormItemLayout+ layout="flex-row-reverse"+ label="Phone"+ description="Control use of phone factors"+ >+ <FormControl_Shadcn_>+ <Select_Shadcn_+ value={field.value}+ onValueChange={field.onChange}+ disabled={!canUpdateConfig || !isProPlanAndUp}+ >+ <SelectTrigger_Shadcn_>+ <SelectValue_Shadcn_ placeholder="Select status" />+ </SelectTrigger_Shadcn_>+ <SelectContent_Shadcn_>+ {MFAFactorSelectionOptions.map((option) => (+ <SelectItem_Shadcn_ key={option.value} value={option.value}>+ {option.label}+ </SelectItem_Shadcn_>+ ))}+ </SelectContent_Shadcn_>+ </Select_Shadcn_>+ </FormControl_Shadcn_>+ </FormItemLayout>+ )}+ />++ {!hasValidMFAProvider && phoneMFAIsEnabled && (+ <Alert_Shadcn_ variant="warning" className="mt-3">+ <WarningIcon />+ <AlertTitle_Shadcn_>+ To use MFA with Phone you should set up a Phone provider or Send SMS Hook.+ </AlertTitle_Shadcn_>+ </Alert_Shadcn_>+ )}+ </CardContent>++ <CardContent>+ <FormField_Shadcn_+ control={phoneForm.control}+ name="MFA_PHONE_OTP_LENGTH"+ render={({ field }) => (+ <FormItemLayout+ layout="flex-row-reverse"+ label="Phone OTP Length"+ description="Number of digits in OTP"+ >+ <FormControl_Shadcn_><Input_Shadcn_type="number"- min={0}+ min={6}max={30}{...field}- disabled={!canUpdateConfig}+ disabled={!canUpdateConfig || !isProPlanAndUp}/>- </PrePostTab>- </FormControl_Shadcn_>- </FormItemLayout>- )}- />- </CardContent>-- <CardFooter className="justify-end space-x-2">- {totpForm.formState.isDirty && (- <Button type="default" onClick={() => totpForm.reset()}>- Cancel- </Button>- )}- <Button- type="primary"- htmlType="submit"- disabled={!canUpdateConfig || isUpdatingTotpForm || !totpForm.formState.isDirty}- loading={isUpdatingTotpForm}- >- Save changes- </Button>- </CardFooter>- </Card>- </form>- </Form_Shadcn_>- </ScaffoldSection>-- <ScaffoldSection isFullWidth>- <ScaffoldSectionTitle className="mb-4">SMS MFA</ScaffoldSectionTitle>-- <Form_Shadcn_ {...phoneForm}>- <form- onSubmit={(e) => {- e.preventDefault()- maybeConfirmPhoneMFAOrSubmit()- }}- className="space-y-4"- >- <Card>- <CardContent className="pt-6">- {promptProPlanUpgrade && (- <div className="mb-4">- <UpgradeToPro- primaryText="Upgrade to Pro"- secondaryText="Advanced MFA requires the Pro Plan"- />- </div>- )}-- <FormField_Shadcn_- control={phoneForm.control}- name="MFA_PHONE"- render={({ field }) => (- <FormItemLayout- layout="flex-row-reverse"- label="Phone"- description="Control use of phone factors"- >- <FormControl_Shadcn_>- <Select_Shadcn_- value={field.value}- onValueChange={field.onChange}- disabled={!canUpdateConfig || !isProPlanAndUp}- >- <SelectTrigger_Shadcn_>- <SelectValue_Shadcn_ placeholder="Select status" />- </SelectTrigger_Shadcn_>- <SelectContent_Shadcn_>- {MFAFactorSelectionOptions.map((option) => (- <SelectItem_Shadcn_ key={option.value} value={option.value}>- {option.label}- </SelectItem_Shadcn_>- ))}- </SelectContent_Shadcn_>- </Select_Shadcn_>- </FormControl_Shadcn_>- </FormItemLayout>- )}- />-- {!hasValidMFAProvider && phoneMFAIsEnabled && (- <Alert_Shadcn_ variant="warning" className="mt-3">- <WarningIcon />- <AlertTitle_Shadcn_>- To use MFA with Phone you should set up a Phone provider or Send SMS Hook.- </AlertTitle_Shadcn_>- </Alert_Shadcn_>- )}- </CardContent>-- <CardContent>- <FormField_Shadcn_- control={phoneForm.control}- name="MFA_PHONE_OTP_LENGTH"- render={({ field }) => (- <FormItemLayout- layout="flex-row-reverse"- label="Phone OTP Length"- description="Number of digits in OTP"- >- <FormControl_Shadcn_>- <Input_Shadcn_- type="number"- min={6}- max={30}- {...field}- disabled={!canUpdateConfig || !isProPlanAndUp}- />- </FormControl_Shadcn_>- </FormItemLayout>- )}- />- </CardContent>-- <CardContent>- <FormField_Shadcn_- control={phoneForm.control}- name="MFA_PHONE_TEMPLATE"- render={({ field }) => (- <FormItemLayout- layout="flex-row-reverse"- label="Phone verification message"- description="To format the OTP code use `{{ .Code }}`"- >- <FormControl_Shadcn_>- <Input_Shadcn_- type="text"- {...field}- disabled={!canUpdateConfig || !isProPlanAndUp}- />- </FormControl_Shadcn_>- </FormItemLayout>+ </FormControl_Shadcn_>+ </FormItemLayout>+ )}+ />+ </CardContent>++ <CardContent>+ <FormField_Shadcn_+ control={phoneForm.control}+ name="MFA_PHONE_TEMPLATE"+ render={({ field }) => (+ <FormItemLayout+ layout="flex-row-reverse"+ label="Phone verification message"+ description="To format the OTP code use `{{ .Code }}`"+ >+ <FormControl_Shadcn_>+ <Input_Shadcn_+ type="text"+ {...field}+ disabled={!canUpdateConfig || !isProPlanAndUp}+ />+ </FormControl_Shadcn_>+ </FormItemLayout>+ )}+ />+ </CardContent>++ <CardFooter className="justify-end space-x-2">+ {phoneForm.formState.isDirty && (+ <Button type="default" onClick={() => phoneForm.reset()}>+ Cancel+ </Button>)}- />- </CardContent>-- <CardFooter className="justify-end space-x-2">- {phoneForm.formState.isDirty && (- <Button type="default" onClick={() => phoneForm.reset()}>- Cancel+ <Button+ type="primary"+ htmlType="submit"+ disabled={+ !canUpdateConfig ||+ isUpdatingPhoneForm ||+ !phoneForm.formState.isDirty ||+ !isProPlanAndUp+ }+ loading={isUpdatingPhoneForm}+ >+ Save changes</Button>- )}- <Button- type="primary"- htmlType="submit"- disabled={- !canUpdateConfig ||- isUpdatingPhoneForm ||- !phoneForm.formState.isDirty ||- !isProPlanAndUp- }- loading={isUpdatingPhoneForm}- >- Save changes- </Button>- </CardFooter>- </Card>- </form>- </Form_Shadcn_>- </ScaffoldSection>+ </CardFooter>+ </Card>+ </form>+ </Form_Shadcn_>+ </PageSectionContent>+ </PageSection><ConfirmationModalvisible={isConfirmationModalVisible}@@ -537,54 +557,59 @@ export const MfaAuthSettingsForm = () => {</p></ConfirmationModal>- <ScaffoldSection isFullWidth>- <ScaffoldSectionTitle className="mb-4">Enhanced MFA Security</ScaffoldSectionTitle>-- <Form_Shadcn_ {...securityForm}>- <form onSubmit={securityForm.handleSubmit(onSubmitSecurityForm)} className="space-y-4">- <Card>- <CardContent className="pt-6">- <FormField_Shadcn_- control={securityForm.control}- name="MFA_ALLOW_LOW_AAL"- render={({ field }) => (- <FormItemLayout- layout="flex-row-reverse"- label="Limit duration of AAL1 sessions"- description="A user's session will be terminated unless they verify one of their factors within 15 minutes of initial sign in. Recommendation: ON"- >- <FormControl_Shadcn_>- <Switch- checked={!field.value}- onCheckedChange={(value) => field.onChange(!value)}- disabled={!canUpdateConfig}- />- </FormControl_Shadcn_>- </FormItemLayout>+ <PageSection>+ <PageSectionMeta>+ <PageSectionSummary>+ <PageSectionTitle>Enhanced MFA Security</PageSectionTitle>+ </PageSectionSummary>+ </PageSectionMeta>+ <PageSectionContent>+ <Form_Shadcn_ {...securityForm}>+ <form onSubmit={securityForm.handleSubmit(onSubmitSecurityForm)} className="space-y-4">+ <Card>+ <CardContent className="pt-6">+ <FormField_Shadcn_+ control={securityForm.control}+ name="MFA_ALLOW_LOW_AAL"+ render={({ field }) => (+ <FormItemLayout+ layout="flex-row-reverse"+ label="Limit duration of AAL1 sessions"+ description="A user's session will be terminated unless they verify one of their factors within 15 minutes of initial sign in. Recommendation: ON"+ >+ <FormControl_Shadcn_>+ <Switch+ checked={!field.value}+ onCheckedChange={(value) => field.onChange(!value)}+ disabled={!canUpdateConfig}+ />+ </FormControl_Shadcn_>+ </FormItemLayout>+ )}+ />+ </CardContent>+ <CardFooter className="justify-end space-x-2">+ {securityForm.formState.isDirty && (+ <Button type="default" onClick={() => securityForm.reset()}>+ Cancel+ </Button>)}- />- </CardContent>- <CardFooter className="justify-end space-x-2">- {securityForm.formState.isDirty && (- <Button type="default" onClick={() => securityForm.reset()}>- Cancel+ <Button+ type="primary"+ htmlType="submit"+ disabled={+ !canUpdateConfig || isUpdatingSecurityForm || !securityForm.formState.isDirty+ }+ loading={isUpdatingPhoneForm}+ >+ Save changes</Button>- )}- <Button- type="primary"- htmlType="submit"- disabled={- !canUpdateConfig || isUpdatingSecurityForm || !securityForm.formState.isDirty- }- loading={isUpdatingPhoneForm}- >- Save changes- </Button>- </CardFooter>- </Card>- </form>- </Form_Shadcn_>- </ScaffoldSection>+ </CardFooter>+ </Card>+ </form>+ </Form_Shadcn_>+ </PageSectionContent>+ </PageSection></>)}diff --git a/apps/studio/components/interfaces/Auth/Overview/OverviewLearnMore.tsx b/apps/studio/components/interfaces/Auth/Overview/OverviewLearnMore.tsxindex 1ba810a08b2..09dc1b0b337 100644--- a/apps/studio/components/interfaces/Auth/Overview/OverviewLearnMore.tsx+++ b/apps/studio/components/interfaces/Auth/Overview/OverviewLearnMore.tsx@@ -1,6 +1,5 @@import { useParams } from 'common'import { SIDEBAR_KEYS } from 'components/layouts/ProjectLayout/LayoutSidebar/LayoutSidebarProvider'-import { ScaffoldSection, ScaffoldSectionTitle } from 'components/layouts/Scaffold'import { Logs } from 'icons'import { BASE_PATH, DOCS_URL } from 'lib/constants'import { BookOpen } from 'lucide-react'@@ -10,6 +9,13 @@ import { useEffect, useState } from 'react'import { useAiAssistantStateSnapshot } from 'state/ai-assistant-state'import { useSidebarManagerSnapshot } from 'state/sidebar-manager-state'import { AiIconAnimation, Button, Card, CardContent, CardHeader, CardTitle, Image } from 'ui'+import {+ PageSection,+ PageSectionContent,+ PageSectionMeta,+ PageSectionSummary,+ PageSectionTitle,+} from 'ui-patterns/PageSection'export const OverviewLearnMore = () => {const [isMounted, setIsMounted] = useState(false)@@ -103,65 +109,71 @@ export const OverviewLearnMore = () => {if (!isMounted) return nullreturn (- <ScaffoldSection isFullWidth>- <ScaffoldSectionTitle className="mb-4">Learn more</ScaffoldSectionTitle>- <div className="grid grid-cols-1 lg:grid-cols-3 gap-4">- {LearnMoreCards.map((card) => (- <Card key={card.label} className="relative">- <CardHeader className="absolute top-0 left-0 right-0 border-b-0">- <CardTitle className="text-foreground-lighter">{card.label}</CardTitle>- </CardHeader>- <CardContent className="p-0">- <div className="bg-black/20 flex w-full">- <Image- src={card.image && card?.image}- alt={card.title}- width={620}- height={324}- className="object-fit"- />- </div>- <div className="p-4 flex flex-col">- <div className="flex flex-col gap-1 mb-4 flex-1">- <h4>{card.title}</h4>- <p className="text-sm text-foreground-lighter">{card.description}</p>+ <PageSection>+ <PageSectionMeta>+ <PageSectionSummary>+ <PageSectionTitle>Learn more</PageSectionTitle>+ </PageSectionSummary>+ </PageSectionMeta>+ <PageSectionContent>+ <div className="grid grid-cols-1 lg:grid-cols-3 gap-4">+ {LearnMoreCards.map((card) => (+ <Card key={card.label} className="relative">+ <CardHeader className="absolute top-0 left-0 right-0 border-b-0">+ <CardTitle className="text-foreground-lighter">{card.label}</CardTitle>+ </CardHeader>+ <CardContent className="p-0">+ <div className="bg-black/20 flex w-full">+ <Image+ src={card.image && card?.image}+ alt={card.title}+ width={620}+ height={324}+ className="object-fit"+ /></div>- <div className="flex flex-col gap-2 items-start mt-auto">- {card.actions.map((action) => {- if ('href' in action) {- return (- <Button- key={action.label}- className="inline-flex"- type="default"- icon={action.icon}- asChild- >- <Link href={action.href} className="inline-flex">+ <div className="p-4 flex flex-col">+ <div className="flex flex-col gap-1 mb-4 flex-1">+ <h4>{card.title}</h4>+ <p className="text-sm text-foreground-lighter">{card.description}</p>+ </div>+ <div className="flex flex-col gap-2 items-start mt-auto">+ {card.actions.map((action) => {+ if ('href' in action) {+ return (+ <Button+ key={action.label}+ className="inline-flex"+ type="default"+ icon={action.icon}+ asChild+ >+ <Link href={action.href} className="inline-flex">+ {action.label}+ </Link>+ </Button>+ )+ } else {+ return (+ <Button+ key={action.label}+ onClick={action.onClick}+ type="default"+ className="inline-flex"+ icon={action.icon}+ >{action.label}- </Link>- </Button>- )- } else {- return (- <Button- key={action.label}- onClick={action.onClick}- type="default"- className="inline-flex"- icon={action.icon}- >- {action.label}- </Button>- )- }- })}+ </Button>+ )+ }+ })}+ </div></div>- </div>- </CardContent>- </Card>- ))}- </div>- </ScaffoldSection>+ </CardContent>+ </Card>+ ))}+ </div>+ </PageSectionContent>+ </PageSection>)}diff --git a/apps/studio/components/interfaces/Auth/Overview/OverviewMetrics.tsx b/apps/studio/components/interfaces/Auth/Overview/OverviewMetrics.tsxindex 91ee99be78a..7ed664f48df 100644--- a/apps/studio/components/interfaces/Auth/Overview/OverviewMetrics.tsx+++ b/apps/studio/components/interfaces/Auth/Overview/OverviewMetrics.tsx@@ -1,5 +1,13 @@import { useQuery } from '@tanstack/react-query'import { useParams } from 'common'+import { getStatusLevel } from 'components/interfaces/UnifiedLogs/UnifiedLogs.utils'+import AlertError from 'components/ui/AlertError'+import { ButtonTooltip } from 'components/ui/ButtonTooltip'+import { DataTableColumnStatusCode } from 'components/ui/DataTable/DataTableColumn/DataTableColumnStatusCode'+import dayjs from 'dayjs'+import { ChevronRight, ExternalLink, HelpCircle, Telescope } from 'lucide-react'+import Link from 'next/link'+import { useRouter } from 'next/router'import {Card,CardContent,@@ -11,35 +19,28 @@ import {TooltipContent,TooltipTrigger,} from 'ui'-import Link from 'next/link'-import { ChevronRight, ExternalLink, HelpCircle, Telescope } from 'lucide-react'-import { Reports } from 'icons'-import {- ScaffoldSection,- ScaffoldSectionTitle,- ScaffoldSectionContent,-} from 'components/layouts/Scaffold'import {- calculatePercentageChange,- getChangeColor,- getMetricValues,- AuthMetricsResponse,- getApiSuccessRates,- getAuthSuccessRates,-} from './OverviewUsage.constants'+ PageSection,+ PageSectionContent,+ PageSectionMeta,+ PageSectionSummary,+ PageSectionTitle,+} from 'ui-patterns/PageSection'import {+ AuthErrorCodeRow,fetchTopAuthErrorCodes,fetchTopResponseErrors,- AuthErrorCodeRow,ResponseErrorRow,} from './OverviewErrors.constants'import { OverviewTable } from './OverviewTable'-import dayjs from 'dayjs'-import AlertError from 'components/ui/AlertError'-import { ButtonTooltip } from 'components/ui/ButtonTooltip'-import { useRouter } from 'next/router'-import { DataTableColumnStatusCode } from 'components/ui/DataTable/DataTableColumn/DataTableColumnStatusCode'-import { getStatusLevel } from 'components/interfaces/UnifiedLogs/UnifiedLogs.utils'+import {+ AuthMetricsResponse,+ calculatePercentageChange,+ getApiSuccessRates,+ getAuthSuccessRates,+ getChangeColor,+ getMetricValues,+} from './OverviewUsage.constants'const StatCard = ({title,@@ -218,7 +219,7 @@ export const OverviewMetrics = ({ metrics, isLoading, error }: OverviewMetricsPrreturn (<>- <ScaffoldSection isFullWidth>+ <PageSection>{!!error && (<AlertErrorclassName="mb-4"@@ -228,18 +229,22 @@ export const OverviewMetrics = ({ metrics, isLoading, error }: OverviewMetricsPr}}/>)}- <div className="flex items-center justify-between mb-4">- <ScaffoldSectionTitle>Usage</ScaffoldSectionTitle>- <Link- href={`/project/${ref}/observability/auth?its=${startDate}&ite=${endDate}&isHelper=true&helperText=Last+24+hours`}- className="text-sm text-link inline-flex items-center gap-x-1.5"- >- <Telescope size={14} />- <span>Go to observability</span>- <ChevronRight size={14} />- </Link>- </div>- <ScaffoldSectionContent className="gap-4">+ <PageSectionMeta>+ <PageSectionSummary>+ <div className="flex items-center justify-between">+ <PageSectionTitle>Usage</PageSectionTitle>+ <Link+ href={`/project/${ref}/reports/auth?its=${startDate}&ite=${endDate}&isHelper=true&helperText=Last+24+hours`}+ className="text-sm text-link inline-flex items-center gap-x-1.5"+ >+ <Telescope size={14} />+ <span>Go to observability</span>+ <ChevronRight size={14} />+ </Link>+ </div>+ </PageSectionSummary>+ </PageSectionMeta>+ <PageSectionContent><div className="grid grid-cols-1 lg:grid-cols-2 gap-4"><StatCardtitle="Auth Activity"@@ -257,15 +262,17 @@ export const OverviewMetrics = ({ metrics, isLoading, error }: OverviewMetricsPrhref={`/project/${ref}/reports/auth?its=${startDate}&ite=${endDate}#usage`}/></div>- </ScaffoldSectionContent>- </ScaffoldSection>+ </PageSectionContent>+ </PageSection>- <ScaffoldSection isFullWidth>- <div className="flex items-center justify-between mb-4">- <ScaffoldSectionTitle>Monitoring</ScaffoldSectionTitle>- </div>- <ScaffoldSectionContent className="gap-4">- <div className="grid grid-cols-1 lg:grid-cols-2 gap-4">+ <PageSection>+ <PageSectionMeta>+ <PageSectionSummary>+ <PageSectionTitle>Monitoring</PageSectionTitle>+ </PageSectionSummary>+ </PageSectionMeta>+ <PageSectionContent>+ <div className="grid grid-cols-1 lg:grid-cols-2 gap-4 mb-4"><StatCardtitle="Auth API Success Rate"current={apiSuccessRateCurrent}@@ -391,8 +398,8 @@ export const OverviewMetrics = ({ metrics, isLoading, error }: OverviewMetricsPr</CardContent></Card></div>- </ScaffoldSectionContent>- </ScaffoldSection>+ </PageSectionContent>+ </PageSection></>)}diff --git a/apps/studio/components/interfaces/Auth/ProtectionAuthSettingsForm/ProtectionAuthSettingsForm.tsx b/apps/studio/components/interfaces/Auth/ProtectionAuthSettingsForm/ProtectionAuthSettingsForm.tsxindex 0d523816eba..91f2c49fadf 100644--- a/apps/studio/components/interfaces/Auth/ProtectionAuthSettingsForm/ProtectionAuthSettingsForm.tsx+++ b/apps/studio/components/interfaces/Auth/ProtectionAuthSettingsForm/ProtectionAuthSettingsForm.tsx@@ -8,7 +8,6 @@ import { toast } from 'sonner'import { boolean, number, object, string } from 'yup'import { useParams } from 'common'-import { ScaffoldSection, ScaffoldSectionTitle } from 'components/layouts/Scaffold'import AlertError from 'components/ui/AlertError'import { InlineLink } from 'components/ui/InlineLink'import NoPermission from 'components/ui/NoPermission'@@ -36,6 +35,13 @@ import {} from 'ui'import { GenericSkeletonLoader } from 'ui-patterns'import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'+import {+ PageSection,+ PageSectionContent,+ PageSectionMeta,+ PageSectionSummary,+ PageSectionTitle,+} from 'ui-patterns/PageSection'import { NO_REQUIRED_CHARACTERS } from '../Auth.constants'const CAPTCHA_PROVIDERS = [@@ -148,181 +154,196 @@ export const ProtectionAuthSettingsForm = () => {if (isError) {return (- <ScaffoldSection isFullWidth>- <AlertError error={authConfigError} subject="Failed to retrieve auth configuration" />- </ScaffoldSection>+ <PageSection>+ <PageSectionContent>+ <AlertError error={authConfigError} subject="Failed to retrieve auth configuration" />+ </PageSectionContent>+ </PageSection>)}if (!canReadConfig) {return (- <ScaffoldSection isFullWidth>- <NoPermission resourceText="view auth configuration settings" />- </ScaffoldSection>+ <PageSection>+ <PageSectionContent>+ <NoPermission resourceText="view auth configuration settings" />+ </PageSectionContent>+ </PageSection>)}if (isLoading) {return (- <ScaffoldSection isFullWidth>- <GenericSkeletonLoader />- </ScaffoldSection>+ <PageSection>+ <PageSectionContent>+ <GenericSkeletonLoader />+ </PageSectionContent>+ </PageSection>)}return (- <ScaffoldSection isFullWidth>- <ScaffoldSectionTitle className="mb-4">Bot and Abuse Protection</ScaffoldSectionTitle>+ <PageSection>+ <PageSectionMeta>+ <PageSectionSummary>+ <PageSectionTitle>Bot and Abuse Protection</PageSectionTitle>+ </PageSectionSummary>+ </PageSectionMeta>+ <PageSectionContent>+ <Form_Shadcn_ {...protectionForm}>+ <form onSubmit={protectionForm.handleSubmit(onSubmitProtection)} className="space-y-4">+ <Card>+ <CardContent>+ <FormField_Shadcn_+ control={protectionForm.control}+ name="SECURITY_CAPTCHA_ENABLED"+ render={({ field }) => (+ <FormItemLayout+ layout="flex-row-reverse"+ label="Enable Captcha protection"+ description="Protect authentication endpoints from bots and abuse."+ >+ <FormControl_Shadcn_>+ <Switch+ checked={field.value}+ onCheckedChange={field.onChange}+ disabled={!canUpdateConfig}+ />+ </FormControl_Shadcn_>+ </FormItemLayout>+ )}+ />+ </CardContent>- <Form_Shadcn_ {...protectionForm}>- <form onSubmit={protectionForm.handleSubmit(onSubmitProtection)} className="space-y-4">- <Card>- <CardContent>- <FormField_Shadcn_- control={protectionForm.control}- name="SECURITY_CAPTCHA_ENABLED"- render={({ field }) => (- <FormItemLayout- layout="flex-row-reverse"- label="Enable Captcha protection"- description="Protect authentication endpoints from bots and abuse."- >- <FormControl_Shadcn_>- <Switch- checked={field.value}- onCheckedChange={field.onChange}- disabled={!canUpdateConfig}- />- </FormControl_Shadcn_>- </FormItemLayout>- )}- />- </CardContent>+ {protectionForm.watch('SECURITY_CAPTCHA_ENABLED') && (+ <>+ <CardContent>+ <FormField_Shadcn_+ control={protectionForm.control}+ name="SECURITY_CAPTCHA_PROVIDER"+ render={({ field }) => {+ const selectedProvider = CAPTCHA_PROVIDERS.find(+ (x) => x.key === field.value+ )+ return (+ <FormItemLayout layout="flex-row-reverse" label="Choose Captcha Provider">+ <FormControl_Shadcn_>+ <Select_Shadcn_+ value={field.value}+ onValueChange={field.onChange}+ disabled={!canUpdateConfig}+ >+ <SelectTrigger_Shadcn_>+ <SelectValue_Shadcn_ placeholder="Select provider" />+ </SelectTrigger_Shadcn_>+ <SelectContent_Shadcn_ align="end">+ {CAPTCHA_PROVIDERS.map((x) => (+ <SelectItem_Shadcn_ key={x.key} value={x.key}>+ {x.label}+ </SelectItem_Shadcn_>+ ))}+ </SelectContent_Shadcn_>+ </Select_Shadcn_>+ </FormControl_Shadcn_>+ <InlineLink+ href={+ field.value === 'hcaptcha'+ ? `${DOCS_URL}/guides/auth/auth-captcha?queryGroups=captcha-method&captcha-method=hcaptcha-1`+ : field.value === 'turnstile'+ ? `${DOCS_URL}/guides/auth/auth-captcha?queryGroups=captcha-method&captcha-method=turnstile-1`+ : '/'+ }+ className="mt-2 text-xs text-foreground-light hover:text-foreground no-underline"+ >+ How to set up {selectedProvider?.label}?+ </InlineLink>+ </FormItemLayout>+ )+ }}+ />+ </CardContent>- {protectionForm.watch('SECURITY_CAPTCHA_ENABLED') && (- <>- <CardContent>- <FormField_Shadcn_- control={protectionForm.control}- name="SECURITY_CAPTCHA_PROVIDER"- render={({ field }) => {- const selectedProvider = CAPTCHA_PROVIDERS.find((x) => x.key === field.value)- return (- <FormItemLayout layout="flex-row-reverse" label="Choose Captcha Provider">+ <CardContent>+ <FormField_Shadcn_+ control={protectionForm.control}+ name="SECURITY_CAPTCHA_SECRET"+ render={({ field }) => (+ <FormItemLayout+ layout="flex-row-reverse"+ label="Captcha secret"+ description="Obtain this secret from the provider."+ ><FormControl_Shadcn_>- <Select_Shadcn_- value={field.value}- onValueChange={field.onChange}- disabled={!canUpdateConfig}- >- <SelectTrigger_Shadcn_>- <SelectValue_Shadcn_ placeholder="Select provider" />- </SelectTrigger_Shadcn_>- <SelectContent_Shadcn_ align="end">- {CAPTCHA_PROVIDERS.map((x) => (- <SelectItem_Shadcn_ key={x.key} value={x.key}>- {x.label}- </SelectItem_Shadcn_>- ))}- </SelectContent_Shadcn_>- </Select_Shadcn_>+ <div className="flex items-center gap-2">+ <PrePostTab+ postTab={+ <Button+ type="text"+ className="p-0"+ onClick={() => setHidden(!hidden)}+ icon={hidden ? <Eye /> : <EyeOff />}+ />+ }+ >+ <Input_Shadcn_+ {...field}+ type={hidden ? 'password' : 'text'}+ disabled={!canUpdateConfig}+ />+ </PrePostTab>+ </div></FormControl_Shadcn_>- <InlineLink- href={- field.value === 'hcaptcha'- ? `${DOCS_URL}/guides/auth/auth-captcha?queryGroups=captcha-method&captcha-method=hcaptcha-1`- : field.value === 'turnstile'- ? `${DOCS_URL}/guides/auth/auth-captcha?queryGroups=captcha-method&captcha-method=turnstile-1`- : '/'- }- className="mt-2 text-xs text-foreground-light hover:text-foreground no-underline"- >- How to set up {selectedProvider?.label}?- </InlineLink></FormItemLayout>- )- }}- />- </CardContent>+ )}+ />+ </CardContent>+ </>+ )}- <CardContent>- <FormField_Shadcn_- control={protectionForm.control}- name="SECURITY_CAPTCHA_SECRET"- render={({ field }) => (- <FormItemLayout- layout="flex-row-reverse"- label="Captcha secret"- description="Obtain this secret from the provider."- >- <FormControl_Shadcn_>- <div className="flex items-center gap-2">- <PrePostTab- postTab={- <Button- type="text"- className="p-0"- onClick={() => setHidden(!hidden)}- icon={hidden ? <Eye /> : <EyeOff />}- />- }- >- <Input_Shadcn_- {...field}- type={hidden ? 'password' : 'text'}- disabled={!canUpdateConfig}- />- </PrePostTab>- </div>- </FormControl_Shadcn_>- </FormItemLayout>- )}- />- </CardContent>- </>- )}+ <CardContent>+ <FormField_Shadcn_+ control={protectionForm.control}+ name="PASSWORD_HIBP_ENABLED"+ render={({ field }) => (+ <FormItemLayout+ layout="flex-row-reverse"+ label="Prevent use of leaked passwords"+ description="Rejects the use of known or easy to guess passwords on sign up or password change. "+ >+ <div className="flex items-center gap-2">+ <Badge variant={field.value ? 'success' : 'default'}>+ {field.value ? 'Enabled' : 'Disabled'}+ </Badge>+ <Link href={`/project/${projectRef}/auth/providers?provider=Email`}>+ <Button type="default">Configure email provider</Button>+ </Link>+ </div>+ </FormItemLayout>+ )}+ />+ </CardContent>- <CardContent>- <FormField_Shadcn_- control={protectionForm.control}- name="PASSWORD_HIBP_ENABLED"- render={({ field }) => (- <FormItemLayout- layout="flex-row-reverse"- label="Prevent use of leaked passwords"- description="Rejects the use of known or easy to guess passwords on sign up or password change. "- >- <div className="flex items-center gap-2">- <Badge variant={field.value ? 'success' : 'default'}>- {field.value ? 'Enabled' : 'Disabled'}- </Badge>- <Link href={`/project/${projectRef}/auth/providers?provider=Email`}>- <Button type="default">Configure email provider</Button>- </Link>- </div>- </FormItemLayout>+ <CardFooter className="justify-end space-x-2">+ {protectionForm.formState.isDirty && (+ <Button type="default" onClick={() => protectionForm.reset()}>+ Cancel+ </Button>)}- />- </CardContent>-- <CardFooter className="justify-end space-x-2">- {protectionForm.formState.isDirty && (- <Button type="default" onClick={() => protectionForm.reset()}>- Cancel+ <Button+ type="primary"+ htmlType="submit"+ disabled={+ !canUpdateConfig || isUpdatingConfig || !protectionForm.formState.isDirty+ }+ loading={isUpdatingConfig}+ >+ Save changes</Button>- )}- <Button- type="primary"- htmlType="submit"- disabled={!canUpdateConfig || isUpdatingConfig || !protectionForm.formState.isDirty}- loading={isUpdatingConfig}- >- Save changes- </Button>- </CardFooter>- </Card>- </form>- </Form_Shadcn_>- </ScaffoldSection>+ </CardFooter>+ </Card>+ </form>+ </Form_Shadcn_>+ </PageSectionContent>+ </PageSection>)}diff --git a/apps/studio/components/interfaces/Auth/RateLimits/RateLimits.tsx b/apps/studio/components/interfaces/Auth/RateLimits/RateLimits.tsxindex acb87a6a011..af573a4c193 100644--- a/apps/studio/components/interfaces/Auth/RateLimits/RateLimits.tsx+++ b/apps/studio/components/interfaces/Auth/RateLimits/RateLimits.tsx@@ -7,7 +7,6 @@ import { toast } from 'sonner'import * as z from 'zod'import { useParams } from 'common'-import { ScaffoldSection } from 'components/layouts/Scaffold'import AlertError from 'components/ui/AlertError'import NoPermission from 'components/ui/NoPermission'import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'@@ -28,6 +27,7 @@ import {TooltipTrigger,} from 'ui'import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'+import { PageSection, PageSectionContent } from 'ui-patterns/PageSection'import { isSmtpEnabled } from '../SmtpForm/SmtpForm.utils'export const RateLimits = () => {@@ -143,377 +143,386 @@ export const RateLimits = () => {if (isError) {return (- <ScaffoldSection isFullWidth>- <AlertError error={error} subject="Failed to retrieve auth configuration" />- </ScaffoldSection>+ <PageSection>+ <PageSectionContent>+ <AlertError error={error} subject="Failed to retrieve auth configuration" />+ </PageSectionContent>+ </PageSection>)}if (!canReadConfig) {return (- <ScaffoldSection isFullWidth>- <NoPermission resourceText="view auth configuration settings" />- </ScaffoldSection>+ <PageSection>+ <PageSectionContent>+ <NoPermission resourceText="view auth configuration settings" />+ </PageSectionContent>+ </PageSection>)}if (isLoading) {return (- <ScaffoldSection isFullWidth>- <GenericSkeletonLoader />- </ScaffoldSection>+ <PageSection>+ <PageSectionContent>+ <GenericSkeletonLoader />+ </PageSectionContent>+ </PageSection>)}return (- <ScaffoldSection isFullWidth>- <Form_Shadcn_ {...form}>- <form className="space-y-4" onSubmit={form.handleSubmit(onSubmit)}>- <Card>- <CardContent className="pt-6">- <FormField_Shadcn_- control={form.control}- name="RATE_LIMIT_EMAIL_SENT"- render={({ field }) => (- <FormItemLayout- layout="flex-row-reverse"- label="Rate limit for sending emails"- description="Number of emails that can be sent per hour from your project"- >- <Tooltip>- <TooltipTrigger asChild>- <FormControl_Shadcn_>- <Input_Shadcn_- type="number"- className="w-24"- min={0}- {...field}- disabled={!canUpdateConfig || !canUpdateEmailLimit}- />- </FormControl_Shadcn_>- </TooltipTrigger>- {!canUpdateConfig || !canUpdateEmailLimit ? (- <TooltipContent side="left" className="w-80 p-4">- {!authConfig.EXTERNAL_EMAIL_ENABLED ? (- <>- <p className="font-medium">- Email-based logins are not enabled for your project- </p>- <p className="mt-1">- Enable email-based logins to update this rate limit- </p>- <div className="mt-3">- <Button asChild type="default" size="tiny">- <Link href={`/project/${projectRef}/auth/providers`}>- View auth providers- </Link>- </Button>- </div>- </>- ) : (- <>- <p className="font-medium">- Custom SMTP provider is required to update this configuration- </p>- <p className="mt-1">- The built-in email service has a fixed rate limit. You will need to- set up your own custom SMTP provider to update your email rate limit- </p>- <div className="mt-3">- <Button asChild type="default" size="tiny">- <Link href={`/project/${projectRef}/auth/smtp`}>- View SMTP settings- </Link>- </Button>- </div>- </>- )}- </TooltipContent>- ) : null}- </Tooltip>- </FormItemLayout>- )}- />- </CardContent>+ <PageSection>+ <PageSectionContent>+ <Form_Shadcn_ {...form}>+ <form className="space-y-4" onSubmit={form.handleSubmit(onSubmit)}>+ <Card>+ <CardContent className="pt-6">+ <FormField_Shadcn_+ control={form.control}+ name="RATE_LIMIT_EMAIL_SENT"+ render={({ field }) => (+ <FormItemLayout+ layout="flex-row-reverse"+ label="Rate limit for sending emails"+ description="Number of emails that can be sent per hour from your project"+ >+ <Tooltip>+ <TooltipTrigger asChild>+ <FormControl_Shadcn_>+ <Input_Shadcn_+ type="number"+ className="w-24"+ min={0}+ {...field}+ disabled={!canUpdateConfig || !canUpdateEmailLimit}+ />+ </FormControl_Shadcn_>+ </TooltipTrigger>+ {!canUpdateConfig || !canUpdateEmailLimit ? (+ <TooltipContent side="left" className="w-80 p-4">+ {!authConfig.EXTERNAL_EMAIL_ENABLED ? (+ <>+ <p className="font-medium">+ Email-based logins are not enabled for your project+ </p>+ <p className="mt-1">+ Enable email-based logins to update this rate limit+ </p>+ <div className="mt-3">+ <Button asChild type="default" size="tiny">+ <Link href={`/project/${projectRef}/auth/providers`}>+ View auth providers+ </Link>+ </Button>+ </div>+ </>+ ) : (+ <>+ <p className="font-medium">+ Custom SMTP provider is required to update this configuration+ </p>+ <p className="mt-1">+ The built-in email service has a fixed rate limit. You will need+ to set up your own custom SMTP provider to update your email rate+ limit+ </p>+ <div className="mt-3">+ <Button asChild type="default" size="tiny">+ <Link href={`/project/${projectRef}/auth/smtp`}>+ View SMTP settings+ </Link>+ </Button>+ </div>+ </>+ )}+ </TooltipContent>+ ) : null}+ </Tooltip>+ </FormItemLayout>+ )}+ />+ </CardContent>- <CardContent>- <FormField_Shadcn_- control={form.control}- name="RATE_LIMIT_SMS_SENT"- render={({ field }) => (- <FormItemLayout- layout="flex-row-reverse"- label="Rate limit for sending SMS messages"- description="Number of SMS messages that can be sent per hour from your project"- >- <Tooltip>- <TooltipTrigger asChild>- <FormControl_Shadcn_>- <Input_Shadcn_- type="number"- className="w-24"- min={0}- {...field}- disabled={!canUpdateConfig || !canUpdateSMSRateLimit}- />- </FormControl_Shadcn_>- </TooltipTrigger>- {!canUpdateConfig || !canUpdateSMSRateLimit ? (- <TooltipContent side="left" className="w-80 p-4">- <p className="font-medium">- Phone-based logins are not enabled for your project- </p>- <p className="mt-1">- Enable phone-based logins to update this rate limit- </p>- <div className="mt-3">- <Button asChild type="default" size="tiny">- <Link href={`/project/${projectRef}/auth/providers`}>- View auth providers- </Link>- </Button>- </div>- </TooltipContent>- ) : null}- </Tooltip>- </FormItemLayout>- )}- />- </CardContent>+ <CardContent>+ <FormField_Shadcn_+ control={form.control}+ name="RATE_LIMIT_SMS_SENT"+ render={({ field }) => (+ <FormItemLayout+ layout="flex-row-reverse"+ label="Rate limit for sending SMS messages"+ description="Number of SMS messages that can be sent per hour from your project"+ >+ <Tooltip>+ <TooltipTrigger asChild>+ <FormControl_Shadcn_>+ <Input_Shadcn_+ type="number"+ className="w-24"+ min={0}+ {...field}+ disabled={!canUpdateConfig || !canUpdateSMSRateLimit}+ />+ </FormControl_Shadcn_>+ </TooltipTrigger>+ {!canUpdateConfig || !canUpdateSMSRateLimit ? (+ <TooltipContent side="left" className="w-80 p-4">+ <p className="font-medium">+ Phone-based logins are not enabled for your project+ </p>+ <p className="mt-1">+ Enable phone-based logins to update this rate limit+ </p>+ <div className="mt-3">+ <Button asChild type="default" size="tiny">+ <Link href={`/project/${projectRef}/auth/providers`}>+ View auth providers+ </Link>+ </Button>+ </div>+ </TooltipContent>+ ) : null}+ </Tooltip>+ </FormItemLayout>+ )}+ />+ </CardContent>- <CardContent>- <FormField_Shadcn_- control={form.control}- name="RATE_LIMIT_TOKEN_REFRESH"- render={({ field }) => (- <FormItemLayout- layout="flex-row-reverse"- label="Rate limit for token refreshes"- description="Number of sessions that can be refreshed in a 5 minute interval per IP address"- >- <Tooltip>- <TooltipTrigger asChild>- <FormControl_Shadcn_>- <Input_Shadcn_- type="number"- className="w-24"- min={0}- {...field}- disabled={!canUpdateConfig}- />- </FormControl_Shadcn_>- </TooltipTrigger>- {!canUpdateConfig && (- <TooltipContent side="left" className="w-80 p-4">- <p className="font-medium">- You don't have permission to update this setting- </p>- <p className="mt-1">- You need additional permissions to update auth configuration settings- </p>- </TooltipContent>+ <CardContent>+ <FormField_Shadcn_+ control={form.control}+ name="RATE_LIMIT_TOKEN_REFRESH"+ render={({ field }) => (+ <FormItemLayout+ layout="flex-row-reverse"+ label="Rate limit for token refreshes"+ description="Number of sessions that can be refreshed in a 5 minute interval per IP address"+ >+ <Tooltip>+ <TooltipTrigger asChild>+ <FormControl_Shadcn_>+ <Input_Shadcn_+ type="number"+ className="w-24"+ min={0}+ {...field}+ disabled={!canUpdateConfig}+ />+ </FormControl_Shadcn_>+ </TooltipTrigger>+ {!canUpdateConfig && (+ <TooltipContent side="left" className="w-80 p-4">+ <p className="font-medium">+ You don't have permission to update this setting+ </p>+ <p className="mt-1">+ You need additional permissions to update auth configuration settings+ </p>+ </TooltipContent>+ )}+ </Tooltip>+ {form.watch('RATE_LIMIT_TOKEN_REFRESH') > 0 && (+ <p className="text-foreground-lighter text-sm mt-2">+ {form.watch('RATE_LIMIT_TOKEN_REFRESH') * 12} requests per hour+ </p>)}- </Tooltip>- {form.watch('RATE_LIMIT_TOKEN_REFRESH') > 0 && (- <p className="text-foreground-lighter text-sm mt-2">- {form.watch('RATE_LIMIT_TOKEN_REFRESH') * 12} requests per hour- </p>- )}- </FormItemLayout>- )}- />- </CardContent>+ </FormItemLayout>+ )}+ />+ </CardContent>- <CardContent>- <FormField_Shadcn_- control={form.control}- name="RATE_LIMIT_VERIFY"- render={({ field }) => (- <FormItemLayout- layout="flex-row-reverse"- label="Rate limit for token verifications"- description="Number of OTP/Magic link verifications that can be made in a 5 minute interval per IP address"- >- <Tooltip>- <TooltipTrigger asChild>- <FormControl_Shadcn_>- <Input_Shadcn_- type="number"- className="w-24"- min={0}- {...field}- disabled={!canUpdateConfig}- />- </FormControl_Shadcn_>- </TooltipTrigger>- {!canUpdateConfig && (- <TooltipContent side="left" className="w-80 p-4">- <p className="font-medium">- You don't have permission to update this setting- </p>- <p className="mt-1">- You need additional permissions to update auth configuration settings- </p>- </TooltipContent>+ <CardContent>+ <FormField_Shadcn_+ control={form.control}+ name="RATE_LIMIT_VERIFY"+ render={({ field }) => (+ <FormItemLayout+ layout="flex-row-reverse"+ label="Rate limit for token verifications"+ description="Number of OTP/Magic link verifications that can be made in a 5 minute interval per IP address"+ >+ <Tooltip>+ <TooltipTrigger asChild>+ <FormControl_Shadcn_>+ <Input_Shadcn_+ type="number"+ className="w-24"+ min={0}+ {...field}+ disabled={!canUpdateConfig}+ />+ </FormControl_Shadcn_>+ </TooltipTrigger>+ {!canUpdateConfig && (+ <TooltipContent side="left" className="w-80 p-4">+ <p className="font-medium">+ You don't have permission to update this setting+ </p>+ <p className="mt-1">+ You need additional permissions to update auth configuration settings+ </p>+ </TooltipContent>+ )}+ </Tooltip>+ {form.watch('RATE_LIMIT_VERIFY') > 0 && (+ <p className="text-foreground-lighter text-sm mt-2">+ {form.watch('RATE_LIMIT_VERIFY') * 12} requests per hour+ </p>)}- </Tooltip>- {form.watch('RATE_LIMIT_VERIFY') > 0 && (- <p className="text-foreground-lighter text-sm mt-2">- {form.watch('RATE_LIMIT_VERIFY') * 12} requests per hour- </p>- )}- </FormItemLayout>- )}- />- </CardContent>+ </FormItemLayout>+ )}+ />+ </CardContent>- <CardContent>- <FormField_Shadcn_- control={form.control}- name="RATE_LIMIT_ANONYMOUS_USERS"- render={({ field }) => (- <FormItemLayout- layout="flex-row-reverse"- label="Rate limit for anonymous users"- description="Number of anonymous sign-ins that can be made per hour per IP address"- >- <Tooltip>- <TooltipTrigger asChild>- <FormControl_Shadcn_>- <Input_Shadcn_- type="number"- className="w-24"- min={0}- {...field}- disabled={!canUpdateConfig || !canUpdateAnonymousUsersRateLimit}- />- </FormControl_Shadcn_>- </TooltipTrigger>- {!canUpdateConfig || !canUpdateAnonymousUsersRateLimit ? (- <TooltipContent side="left" className="w-80 p-4">- <p className="font-medium">- Anonymous sign-ins are not enabled for your project. Enable them to- control this rate limit.- </p>- <div className="mt-3">- <Button asChild type="default" size="tiny">- <Link href={`/project/${projectRef}/auth/providers`}>- View auth settings- </Link>- </Button>- </div>- </TooltipContent>- ) : null}- </Tooltip>- </FormItemLayout>- )}- />- </CardContent>+ <CardContent>+ <FormField_Shadcn_+ control={form.control}+ name="RATE_LIMIT_ANONYMOUS_USERS"+ render={({ field }) => (+ <FormItemLayout+ layout="flex-row-reverse"+ label="Rate limit for anonymous users"+ description="Number of anonymous sign-ins that can be made per hour per IP address"+ >+ <Tooltip>+ <TooltipTrigger asChild>+ <FormControl_Shadcn_>+ <Input_Shadcn_+ type="number"+ className="w-24"+ min={0}+ {...field}+ disabled={!canUpdateConfig || !canUpdateAnonymousUsersRateLimit}+ />+ </FormControl_Shadcn_>+ </TooltipTrigger>+ {!canUpdateConfig || !canUpdateAnonymousUsersRateLimit ? (+ <TooltipContent side="left" className="w-80 p-4">+ <p className="font-medium">+ Anonymous sign-ins are not enabled for your project. Enable them to+ control this rate limit.+ </p>+ <div className="mt-3">+ <Button asChild type="default" size="tiny">+ <Link href={`/project/${projectRef}/auth/providers`}>+ View auth settings+ </Link>+ </Button>+ </div>+ </TooltipContent>+ ) : null}+ </Tooltip>+ </FormItemLayout>+ )}+ />+ </CardContent>- <CardContent>- <FormField_Shadcn_- control={form.control}- name="RATE_LIMIT_OTP"- render={({ field }) => (- <FormItemLayout- layout="flex-row-reverse"- label="Rate limit for sign-ups and sign-ins"- description="Number of sign-up and sign-in requests that can be made in a 5 minute interval per IP address (excludes anonymous users)"- >- <Tooltip>- <TooltipTrigger asChild>- <FormControl_Shadcn_>- <Input_Shadcn_- type="number"- className="w-24"- min={0}- {...field}- disabled={!canUpdateConfig}- />- </FormControl_Shadcn_>- </TooltipTrigger>- {!canUpdateConfig && (- <TooltipContent side="left" className="w-80 p-4">- <p className="font-medium">- You don't have permission to update this setting- </p>- <p className="mt-1">- You need additional permissions to update auth configuration settings- </p>- </TooltipContent>+ <CardContent>+ <FormField_Shadcn_+ control={form.control}+ name="RATE_LIMIT_OTP"+ render={({ field }) => (+ <FormItemLayout+ layout="flex-row-reverse"+ label="Rate limit for sign-ups and sign-ins"+ description="Number of sign-up and sign-in requests that can be made in a 5 minute interval per IP address (excludes anonymous users)"+ >+ <Tooltip>+ <TooltipTrigger asChild>+ <FormControl_Shadcn_>+ <Input_Shadcn_+ type="number"+ className="w-24"+ min={0}+ {...field}+ disabled={!canUpdateConfig}+ />+ </FormControl_Shadcn_>+ </TooltipTrigger>+ {!canUpdateConfig && (+ <TooltipContent side="left" className="w-80 p-4">+ <p className="font-medium">+ You don't have permission to update this setting+ </p>+ <p className="mt-1">+ You need additional permissions to update auth configuration settings+ </p>+ </TooltipContent>+ )}+ </Tooltip>+ {form.watch('RATE_LIMIT_OTP') > 0 && (+ <p className="text-foreground-lighter text-sm mt-2">+ {form.watch('RATE_LIMIT_OTP') * 12} requests per hour+ </p>)}- </Tooltip>- {form.watch('RATE_LIMIT_OTP') > 0 && (- <p className="text-foreground-lighter text-sm mt-2">- {form.watch('RATE_LIMIT_OTP') * 12} requests per hour- </p>- )}- </FormItemLayout>- )}- />- </CardContent>+ </FormItemLayout>+ )}+ />+ </CardContent>- <CardContent>- <FormField_Shadcn_- control={form.control}- name="RATE_LIMIT_WEB3"- render={({ field }) => (- <FormItemLayout- layout="flex-row-reverse"- label="Rate limit for Web3 sign-ups and sign-ins"- description="Number of Web3 sign-up or sign-in requests that can be made per IP address in 5 minutes"- >- <Tooltip>- <TooltipTrigger asChild>- <FormControl_Shadcn_>- <Input_Shadcn_- type="number"- className="w-24"- min={0}- {...field}- disabled={!canUpdateConfig || !canUpdateWeb3RateLimit}- />- </FormControl_Shadcn_>- </TooltipTrigger>- {!canUpdateConfig || !canUpdateWeb3RateLimit ? (- <TooltipContent side="left" className="w-80 p-4">- <p className="font-medium">- Web3 auth provider is not enabled for this project. Enable it to control- this rate limit.- </p>- <div className="mt-3">- <Button asChild type="default" size="tiny">- <Link href={`/project/${projectRef}/auth/providers`}>- View Auth provider settings- </Link>- </Button>- </div>- </TooltipContent>- ) : null}- </Tooltip>- </FormItemLayout>- )}- />- </CardContent>+ <CardContent>+ <FormField_Shadcn_+ control={form.control}+ name="RATE_LIMIT_WEB3"+ render={({ field }) => (+ <FormItemLayout+ layout="flex-row-reverse"+ label="Rate limit for Web3 sign-ups and sign-ins"+ description="Number of Web3 sign-up or sign-in requests that can be made per IP address in 5 minutes"+ >+ <Tooltip>+ <TooltipTrigger asChild>+ <FormControl_Shadcn_>+ <Input_Shadcn_+ type="number"+ className="w-24"+ min={0}+ {...field}+ disabled={!canUpdateConfig || !canUpdateWeb3RateLimit}+ />+ </FormControl_Shadcn_>+ </TooltipTrigger>+ {!canUpdateConfig || !canUpdateWeb3RateLimit ? (+ <TooltipContent side="left" className="w-80 p-4">+ <p className="font-medium">+ Web3 auth provider is not enabled for this project. Enable it to+ control this rate limit.+ </p>+ <div className="mt-3">+ <Button asChild type="default" size="tiny">+ <Link href={`/project/${projectRef}/auth/providers`}>+ View Auth provider settings+ </Link>+ </Button>+ </div>+ </TooltipContent>+ ) : null}+ </Tooltip>+ </FormItemLayout>+ )}+ />+ </CardContent>- <CardFooter className="justify-end space-x-2">- {form.formState.isDirty && (- <Button type="default" onClick={() => form.reset()}>- Cancel+ <CardFooter className="justify-end space-x-2">+ {form.formState.isDirty && (+ <Button type="default" onClick={() => form.reset()}>+ Cancel+ </Button>+ )}+ <Button+ type="primary"+ htmlType="submit"+ disabled={!canUpdateConfig || isUpdatingConfig || !form.formState.isDirty}+ loading={isUpdatingConfig}+ >+ Save changes</Button>- )}- <Button- type="primary"- htmlType="submit"- disabled={!canUpdateConfig || isUpdatingConfig || !form.formState.isDirty}- loading={isUpdatingConfig}- >- Save changes- </Button>- </CardFooter>- </Card>- </form>- </Form_Shadcn_>- </ScaffoldSection>+ </CardFooter>+ </Card>+ </form>+ </Form_Shadcn_>+ </PageSectionContent>+ </PageSection>)}diff --git a/apps/studio/components/interfaces/Auth/RedirectUrls/RedirectUrls.tsx b/apps/studio/components/interfaces/Auth/RedirectUrls/RedirectUrls.tsxindex d1434eb583c..487d46ada2c 100644--- a/apps/studio/components/interfaces/Auth/RedirectUrls/RedirectUrls.tsx+++ b/apps/studio/components/interfaces/Auth/RedirectUrls/RedirectUrls.tsx@@ -2,11 +2,6 @@ import { useMemo, useState } from 'react'import { toast } from 'sonner'import { useParams } from 'common'-import {- ScaffoldDescription,- ScaffoldSection,- ScaffoldSectionTitle,-} from 'components/layouts/Scaffold'import AlertError from 'components/ui/AlertError'import { DocsButton } from 'components/ui/DocsButton'import { HorizontalShimmerWithIcon } from 'components/ui/Shimmers'@@ -14,6 +9,15 @@ import { useAuthConfigQuery } from 'data/auth/auth-config-query'import { useAuthConfigUpdateMutation } from 'data/auth/auth-config-update-mutation'import { DOCS_URL } from 'lib/constants'import { Button, Modal, ScrollArea, cn } from 'ui'+import {+ PageSection,+ PageSectionAside,+ PageSectionContent,+ PageSectionDescription,+ PageSectionMeta,+ PageSectionSummary,+ PageSectionTitle,+} from 'ui-patterns/PageSection'import { AddNewURLModal } from './AddNewURLModal'import { RedirectUrlList } from './RedirectUrlList'import { ValueContainer } from './ValueContainer'@@ -66,104 +70,107 @@ export const RedirectUrls = () => {}return (- <ScaffoldSection isFullWidth>- <div className="flex items-center justify-between mb-6">- <div>- <ScaffoldSectionTitle>Redirect URLs</ScaffoldSectionTitle>- <ScaffoldDescription>+ <PageSection>+ <PageSectionMeta>+ <PageSectionSummary>+ <PageSectionTitle>Redirect URLs</PageSectionTitle>+ <PageSectionDescription>URLs that auth providers are permitted to redirect to post authentication. Wildcards areallowed, for example, https://*.domain.com- </ScaffoldDescription>- </div>- <DocsButton href={`${DOCS_URL}/guides/auth/concepts/redirect-urls`} />- </div>+ </PageSectionDescription>+ </PageSectionSummary>+ <PageSectionAside>+ <DocsButton href={`${DOCS_URL}/guides/auth/concepts/redirect-urls`} />+ </PageSectionAside>+ </PageSectionMeta>+ <PageSectionContent>+ {isLoading && (+ <>+ <ValueContainer>+ <HorizontalShimmerWithIcon />+ </ValueContainer>+ <ValueContainer>+ <HorizontalShimmerWithIcon />+ </ValueContainer>+ </>+ )}- {isLoading && (- <>- <ValueContainer>- <HorizontalShimmerWithIcon />- </ValueContainer>- <ValueContainer>- <HorizontalShimmerWithIcon />- </ValueContainer>- </>- )}+ {isError && (+ <AlertError error={authConfigError} subject="Failed to retrieve auth configuration" />+ )}- {isError && (- <AlertError error={authConfigError} subject="Failed to retrieve auth configuration" />- )}+ {isSuccess && (+ <RedirectUrlList+ allowList={URI_ALLOW_LIST_ARRAY}+ selectedUrls={selectedUrls}+ onSelectUrl={setSelectedUrls}+ onSelectAddURL={() => setOpen(true)}+ onSelectClearSelection={() => setSelectedUrls([])}+ onSelectRemoveURLs={() => setOpenRemoveSelected(true)}+ />+ )}- {isSuccess && (- <RedirectUrlList+ <AddNewURLModal+ visible={open}allowList={URI_ALLOW_LIST_ARRAY}- selectedUrls={selectedUrls}- onSelectUrl={setSelectedUrls}- onSelectAddURL={() => setOpen(true)}- onSelectClearSelection={() => setSelectedUrls([])}- onSelectRemoveURLs={() => setOpenRemoveSelected(true)}+ onClose={() => setOpen(false)}/>- )}-- <AddNewURLModal- visible={open}- allowList={URI_ALLOW_LIST_ARRAY}- onClose={() => setOpen(false)}- />- <Modal- hideFooter- size="large"- visible={openRemoveSelected}- header="Remove URLs"- onCancel={() => {- setSelectedUrls([])- setOpenRemoveSelected(false)- }}- >- <Modal.Content className="flex flex-col gap-y-2">- <p className="mb-2 text-sm text-foreground-light">- Are you sure you want to remove the following {selectedUrls.length} URL- {selectedUrls.length > 1 ? 's' : ''}?- </p>- <ScrollArea className={cn(selectedUrls.length > 4 ? 'h-[250px]' : '')}>- <div className="flex flex-col -space-y-1">- {selectedUrls.map((url) => {- return (- <ValueContainer key={url} className="px-4 py-3 hover:bg-surface-100">- {url}- </ValueContainer>- )- })}- </div>- </ScrollArea>- <p className="text-foreground-light text-sm">- These URLs will no longer work with your authentication configuration.- </p>- </Modal.Content>- <Modal.Separator />- <Modal.Content className="flex items-center gap-x-2">- <Button- block- type="default"- size="medium"- onClick={() => {- setSelectedUrls([])- setOpenRemoveSelected(false)- }}- >- Cancel- </Button>- <Button- block- size="medium"- type="warning"- loading={isUpdatingConfig}- onClick={() => onConfirmDeleteUrl(selectedUrls)}- >- {isUpdatingConfig ? 'Removing...' : 'Remove URL'}- </Button>- </Modal.Content>- </Modal>- </ScaffoldSection>+ <Modal+ hideFooter+ size="large"+ visible={openRemoveSelected}+ header="Remove URLs"+ onCancel={() => {+ setSelectedUrls([])+ setOpenRemoveSelected(false)+ }}+ >+ <Modal.Content className="flex flex-col gap-y-2">+ <p className="mb-2 text-sm text-foreground-light">+ Are you sure you want to remove the following {selectedUrls.length} URL+ {selectedUrls.length > 1 ? 's' : ''}?+ </p>+ <ScrollArea className={cn(selectedUrls.length > 4 ? 'h-[250px]' : '')}>+ <div className="flex flex-col -space-y-1">+ {selectedUrls.map((url) => {+ return (+ <ValueContainer key={url} className="px-4 py-3 hover:bg-surface-100">+ {url}+ </ValueContainer>+ )+ })}+ </div>+ </ScrollArea>+ <p className="text-foreground-light text-sm">+ These URLs will no longer work with your authentication configuration.+ </p>+ </Modal.Content>+ <Modal.Separator />+ <Modal.Content className="flex items-center gap-x-2">+ <Button+ block+ type="default"+ size="medium"+ onClick={() => {+ setSelectedUrls([])+ setOpenRemoveSelected(false)+ }}+ >+ Cancel+ </Button>+ <Button+ block+ size="medium"+ type="warning"+ loading={isUpdatingConfig}+ onClick={() => onConfirmDeleteUrl(selectedUrls)}+ >+ {isUpdatingConfig ? 'Removing...' : 'Remove URL'}+ </Button>+ </Modal.Content>+ </Modal>+ </PageSectionContent>+ </PageSection>)}diff --git a/apps/studio/components/interfaces/Auth/SessionsAuthSettingsForm/SessionsAuthSettingsForm.tsx b/apps/studio/components/interfaces/Auth/SessionsAuthSettingsForm/SessionsAuthSettingsForm.tsxindex 2205f7f0235..e2cf14b42a3 100644--- a/apps/studio/components/interfaces/Auth/SessionsAuthSettingsForm/SessionsAuthSettingsForm.tsx+++ b/apps/studio/components/interfaces/Auth/SessionsAuthSettingsForm/SessionsAuthSettingsForm.tsx@@ -6,7 +6,6 @@ import { toast } from 'sonner'import * as z from 'zod'import { useParams } from 'common'-import { ScaffoldSection, ScaffoldSectionTitle } from 'components/layouts/Scaffold'import AlertError from 'components/ui/AlertError'import NoPermission from 'components/ui/NoPermission'import UpgradeToPro from 'components/ui/UpgradeToPro'@@ -29,6 +28,13 @@ import {} from 'ui'import { GenericSkeletonLoader } from 'ui-patterns'import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'+import {+ PageSection,+ PageSectionContent,+ PageSectionMeta,+ PageSectionSummary,+ PageSectionTitle,+} from 'ui-patterns/PageSection'function HoursOrNeverText({ value }: { value: number }) {if (value === 0) {@@ -158,223 +164,239 @@ export const SessionsAuthSettingsForm = () => {if (isError) {return (- <ScaffoldSection isFullWidth>- <AlertError error={authConfigError} subject="Failed to retrieve auth configuration" />- </ScaffoldSection>+ <PageSection>+ <PageSectionContent>+ <AlertError error={authConfigError} subject="Failed to retrieve auth configuration" />+ </PageSectionContent>+ </PageSection>)}if (!canReadConfig) {return (- <ScaffoldSection isFullWidth>- <NoPermission resourceText="view auth configuration settings" />- </ScaffoldSection>+ <PageSection>+ <PageSectionContent>+ <NoPermission resourceText="view auth configuration settings" />+ </PageSectionContent>+ </PageSection>)}if (isLoading) {return (- <ScaffoldSection isFullWidth>- <GenericSkeletonLoader />- </ScaffoldSection>+ <PageSection>+ <PageSectionContent>+ <GenericSkeletonLoader />+ </PageSectionContent>+ </PageSection>)}return (<>- <ScaffoldSection isFullWidth>- <ScaffoldSectionTitle className="mb-4">Refresh Tokens</ScaffoldSectionTitle>-- <Form_Shadcn_ {...refreshTokenForm}>- <form- onSubmit={refreshTokenForm.handleSubmit(onSubmitRefreshTokens)}- className="space-y-4"- >- <Card>- <CardContent className="pt-6">- <FormField_Shadcn_- control={refreshTokenForm.control}- name="REFRESH_TOKEN_ROTATION_ENABLED"- render={({ field }) => (- <FormItemLayout- layout="flex-row-reverse"- label="Detect and revoke potentially compromised refresh tokens"- description="Prevent replay attacks from potentially compromised refresh tokens."- >- <FormControl_Shadcn_>- <Switch- checked={field.value}- onCheckedChange={field.onChange}- disabled={!canUpdateConfig}- />- </FormControl_Shadcn_>- </FormItemLayout>- )}- />- </CardContent>- <CardContent>- <FormField_Shadcn_- control={refreshTokenForm.control}- name="SECURITY_REFRESH_TOKEN_REUSE_INTERVAL"- render={({ field }) => (- <FormItemLayout- layout="flex-row-reverse"- label="Refresh token reuse interval"- description="Time interval where the same refresh token can be used multiple times to request for an access token. Recommendation: 10 seconds."- >- <FormControl_Shadcn_>- <PrePostTab postTab="seconds">- <Input_Shadcn_- type="number"- min={0}- {...field}+ <PageSection>+ <PageSectionMeta>+ <PageSectionSummary>+ <PageSectionTitle>Refresh Tokens</PageSectionTitle>+ </PageSectionSummary>+ </PageSectionMeta>+ <PageSectionContent>+ <Form_Shadcn_ {...refreshTokenForm}>+ <form+ onSubmit={refreshTokenForm.handleSubmit(onSubmitRefreshTokens)}+ className="space-y-4"+ >+ <Card>+ <CardContent className="pt-6">+ <FormField_Shadcn_+ control={refreshTokenForm.control}+ name="REFRESH_TOKEN_ROTATION_ENABLED"+ render={({ field }) => (+ <FormItemLayout+ layout="flex-row-reverse"+ label="Detect and revoke potentially compromised refresh tokens"+ description="Prevent replay attacks from potentially compromised refresh tokens."+ >+ <FormControl_Shadcn_>+ <Switch+ checked={field.value}+ onCheckedChange={field.onChange}disabled={!canUpdateConfig}/>- </PrePostTab>- </FormControl_Shadcn_>- </FormItemLayout>- )}- />- </CardContent>- <CardFooter className="justify-end space-x-2">- {refreshTokenForm.formState.isDirty && (- <Button type="default" onClick={() => refreshTokenForm.reset()}>- Cancel- </Button>- )}- <Button- type="primary"- htmlType="submit"- disabled={- !canUpdateConfig ||- isUpdatingRefreshTokens ||- !refreshTokenForm.formState.isDirty- }- loading={isUpdatingRefreshTokens}- >- Save changes- </Button>- </CardFooter>- </Card>- </form>- </Form_Shadcn_>- </ScaffoldSection>-- <ScaffoldSection isFullWidth>- <ScaffoldSectionTitle className="mb-4">User Sessions</ScaffoldSectionTitle>-- <Form_Shadcn_ {...userSessionsForm}>- <form- onSubmit={userSessionsForm.handleSubmit(onSubmitUserSessions)}- className="space-y-4"- >- <Card>- <CardContent>- <FormField_Shadcn_- control={userSessionsForm.control}- name="SESSIONS_SINGLE_PER_USER"- render={({ field }) => (- <FormItemLayout- layout="flex-row-reverse"- label="Enforce single session per user"- description="If enabled, all but a user's most recently active session will be terminated."- >- <FormControl_Shadcn_>- <Switch- checked={field.value}- onCheckedChange={field.onChange}- disabled={!canUpdateConfig || !isProPlanAndUp}- />- </FormControl_Shadcn_>- </FormItemLayout>- )}- />- </CardContent>-- <CardContent>- <FormField_Shadcn_- control={userSessionsForm.control}- name="SESSIONS_TIMEBOX"- render={({ field }) => (- <FormItemLayout- layout="flex-row-reverse"- label="Time-box user sessions"- description="The amount of time before a user is forced to sign in again. Use 0 for never."- >- <div className="flex items-center">+ </FormControl_Shadcn_>+ </FormItemLayout>+ )}+ />+ </CardContent>+ <CardContent>+ <FormField_Shadcn_+ control={refreshTokenForm.control}+ name="SECURITY_REFRESH_TOKEN_REUSE_INTERVAL"+ render={({ field }) => (+ <FormItemLayout+ layout="flex-row-reverse"+ label="Refresh token reuse interval"+ description="Time interval where the same refresh token can be used multiple times to request for an access token. Recommendation: 10 seconds."+ ><FormControl_Shadcn_>- <PrePostTab postTab={<HoursOrNeverText value={field.value || 0} />}>+ <PrePostTab postTab="seconds"><Input_Shadcn_type="number"min={0}{...field}- disabled={!canUpdateConfig || !isProPlanAndUp}+ disabled={!canUpdateConfig}/></PrePostTab></FormControl_Shadcn_>- </div>- </FormItemLayout>+ </FormItemLayout>+ )}+ />+ </CardContent>+ <CardFooter className="justify-end space-x-2">+ {refreshTokenForm.formState.isDirty && (+ <Button type="default" onClick={() => refreshTokenForm.reset()}>+ Cancel+ </Button>)}- />- </CardContent>+ <Button+ type="primary"+ htmlType="submit"+ disabled={+ !canUpdateConfig ||+ isUpdatingRefreshTokens ||+ !refreshTokenForm.formState.isDirty+ }+ loading={isUpdatingRefreshTokens}+ >+ Save changes+ </Button>+ </CardFooter>+ </Card>+ </form>+ </Form_Shadcn_>+ </PageSectionContent>+ </PageSection>- <CardContent>- <FormField_Shadcn_- control={userSessionsForm.control}- name="SESSIONS_INACTIVITY_TIMEOUT"- render={({ field }) => (- <FormItemLayout- layout="flex-row-reverse"- label="Inactivity timeout"- description="The amount of time a user needs to be inactive to be forced to sign in again. Use 0 for never."- >- <div className="flex items-center">+ <PageSection>+ <PageSectionMeta>+ <PageSectionSummary>+ <PageSectionTitle>User Sessions</PageSectionTitle>+ </PageSectionSummary>+ </PageSectionMeta>+ <PageSectionContent>+ <Form_Shadcn_ {...userSessionsForm}>+ <form+ onSubmit={userSessionsForm.handleSubmit(onSubmitUserSessions)}+ className="space-y-4"+ >+ <Card>+ <CardContent>+ <FormField_Shadcn_+ control={userSessionsForm.control}+ name="SESSIONS_SINGLE_PER_USER"+ render={({ field }) => (+ <FormItemLayout+ layout="flex-row-reverse"+ label="Enforce single session per user"+ description="If enabled, all but a user's most recently active session will be terminated."+ ><FormControl_Shadcn_>- <PrePostTab postTab={<HoursOrNeverText value={field.value || 0} />}>- <Input_Shadcn_- type="number"- {...field}- disabled={!canUpdateConfig || !isProPlanAndUp}- />- </PrePostTab>+ <Switch+ checked={field.value}+ onCheckedChange={field.onChange}+ disabled={!canUpdateConfig || !isProPlanAndUp}+ /></FormControl_Shadcn_>- </div>- </FormItemLayout>- )}- />- </CardContent>+ </FormItemLayout>+ )}+ />+ </CardContent>- {promptProPlanUpgrade && (- <UpgradeToPro- fullWidth- primaryText="Configuring user sessions is only available on the Pro Plan and above"- secondaryText="Upgrade to the Pro plan to configure settings for user sessions"- />- )}+ <CardContent>+ <FormField_Shadcn_+ control={userSessionsForm.control}+ name="SESSIONS_TIMEBOX"+ render={({ field }) => (+ <FormItemLayout+ layout="flex-row-reverse"+ label="Time-box user sessions"+ description="The amount of time before a user is forced to sign in again. Use 0 for never."+ >+ <div className="flex items-center">+ <FormControl_Shadcn_>+ <PrePostTab postTab={<HoursOrNeverText value={field.value || 0} />}>+ <Input_Shadcn_+ type="number"+ min={0}+ {...field}+ disabled={!canUpdateConfig || !isProPlanAndUp}+ />+ </PrePostTab>+ </FormControl_Shadcn_>+ </div>+ </FormItemLayout>+ )}+ />+ </CardContent>- <CardFooter className="justify-end space-x-2">- {userSessionsForm.formState.isDirty && (- <Button type="default" onClick={() => userSessionsForm.reset()}>- Cancel- </Button>+ <CardContent>+ <FormField_Shadcn_+ control={userSessionsForm.control}+ name="SESSIONS_INACTIVITY_TIMEOUT"+ render={({ field }) => (+ <FormItemLayout+ layout="flex-row-reverse"+ label="Inactivity timeout"+ description="The amount of time a user needs to be inactive to be forced to sign in again. Use 0 for never."+ >+ <div className="flex items-center">+ <FormControl_Shadcn_>+ <PrePostTab postTab={<HoursOrNeverText value={field.value || 0} />}>+ <Input_Shadcn_+ type="number"+ {...field}+ disabled={!canUpdateConfig || !isProPlanAndUp}+ />+ </PrePostTab>+ </FormControl_Shadcn_>+ </div>+ </FormItemLayout>+ )}+ />+ </CardContent>++ {promptProPlanUpgrade && (+ <UpgradeToPro+ fullWidth+ primaryText="Configuring user sessions is only available on the Pro Plan and above"+ secondaryText="Upgrade to the Pro plan to configure settings for user sessions"+ />)}- <Button- type="primary"- htmlType="submit"- disabled={- !canUpdateConfig ||- isUpdatingUserSessions ||- !userSessionsForm.formState.isDirty- }- loading={isUpdatingUserSessions}- >- Save changes- </Button>- </CardFooter>- </Card>- </form>- </Form_Shadcn_>- </ScaffoldSection>++ <CardFooter className="justify-end space-x-2">+ {userSessionsForm.formState.isDirty && (+ <Button type="default" onClick={() => userSessionsForm.reset()}>+ Cancel+ </Button>+ )}+ <Button+ type="primary"+ htmlType="submit"+ disabled={+ !canUpdateConfig ||+ isUpdatingUserSessions ||+ !userSessionsForm.formState.isDirty+ }+ loading={isUpdatingUserSessions}+ >+ Save changes+ </Button>+ </CardFooter>+ </Card>+ </form>+ </Form_Shadcn_>+ </PageSectionContent>+ </PageSection></>)}diff --git a/apps/studio/components/interfaces/Auth/SiteUrl/SiteUrl.tsx b/apps/studio/components/interfaces/Auth/SiteUrl/SiteUrl.tsxindex 5c38c88261d..52816817009 100644--- a/apps/studio/components/interfaces/Auth/SiteUrl/SiteUrl.tsx+++ b/apps/studio/components/interfaces/Auth/SiteUrl/SiteUrl.tsx@@ -6,7 +6,6 @@ import { toast } from 'sonner'import { object, string } from 'yup'import { useParams } from 'common'-import { ScaffoldSection, ScaffoldSectionTitle } from 'components/layouts/Scaffold'import AlertError from 'components/ui/AlertError'import { useAuthConfigQuery } from 'data/auth/auth-config-query'import { useAuthConfigUpdateMutation } from 'data/auth/auth-config-update-mutation'@@ -23,6 +22,13 @@ import {} from 'ui'import { GenericSkeletonLoader } from 'ui-patterns'import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'+import {+ PageSection,+ PageSectionContent,+ PageSectionMeta,+ PageSectionSummary,+ PageSectionTitle,+} from 'ui-patterns/PageSection'const schema = object({SITE_URL: string().required('Must have a Site URL'),@@ -79,64 +85,73 @@ const SiteUrl = () => {if (isError) {return (- <ScaffoldSection isFullWidth>- <AlertError error={authConfigError} subject="Failed to retrieve auth configuration" />- </ScaffoldSection>+ <PageSection>+ <PageSectionContent>+ <AlertError error={authConfigError} subject="Failed to retrieve auth configuration" />+ </PageSectionContent>+ </PageSection>)}if (isLoading) {return (- <ScaffoldSection isFullWidth>- <GenericSkeletonLoader />- </ScaffoldSection>+ <PageSection>+ <PageSectionContent>+ <GenericSkeletonLoader />+ </PageSectionContent>+ </PageSection>)}return (- <ScaffoldSection isFullWidth>- <ScaffoldSectionTitle className="mb-4">Site URL</ScaffoldSectionTitle>+ <PageSection>+ <PageSectionMeta>+ <PageSectionSummary>+ <PageSectionTitle>Site URL</PageSectionTitle>+ </PageSectionSummary>+ </PageSectionMeta>+ <PageSectionContent>+ <Form_Shadcn_ {...siteUrlForm}>+ <form onSubmit={siteUrlForm.handleSubmit(onSubmitSiteUrl)} className="space-y-4">+ <Card>+ <CardContent className="pt-6">+ <FormField_Shadcn_+ control={siteUrlForm.control}+ name="SITE_URL"+ render={({ field }) => (+ <FormItemLayout+ layout="flex-row-reverse"+ label="Site URL"+ description="Configure the default redirect URL used when a redirect URL is not specified or doesn't match one from the allow list. This value is also exposed as a template variable in the email templates section. Wildcards cannot be used here."+ >+ <FormControl_Shadcn_>+ <Input_Shadcn_ {...field} disabled={!canUpdateConfig} />+ </FormControl_Shadcn_>+ </FormItemLayout>+ )}+ />+ </CardContent>- <Form_Shadcn_ {...siteUrlForm}>- <form onSubmit={siteUrlForm.handleSubmit(onSubmitSiteUrl)} className="space-y-4">- <Card>- <CardContent className="pt-6">- <FormField_Shadcn_- control={siteUrlForm.control}- name="SITE_URL"- render={({ field }) => (- <FormItemLayout- layout="flex-row-reverse"- label="Site URL"- description="Configure the default redirect URL used when a redirect URL is not specified or doesn't match one from the allow list. This value is also exposed as a template variable in the email templates section. Wildcards cannot be used here."- >- <FormControl_Shadcn_>- <Input_Shadcn_ {...field} disabled={!canUpdateConfig} />- </FormControl_Shadcn_>- </FormItemLayout>+ <CardFooter className="justify-end space-x-2">+ {siteUrlForm.formState.isDirty && (+ <Button type="default" onClick={() => siteUrlForm.reset()}>+ Cancel+ </Button>)}- />- </CardContent>-- <CardFooter className="justify-end space-x-2">- {siteUrlForm.formState.isDirty && (- <Button type="default" onClick={() => siteUrlForm.reset()}>- Cancel+ <Button+ type="primary"+ htmlType="submit"+ disabled={!canUpdateConfig || isUpdatingSiteUrl || !siteUrlForm.formState.isDirty}+ loading={isUpdatingSiteUrl}+ >+ Save changes</Button>- )}- <Button- type="primary"- htmlType="submit"- disabled={!canUpdateConfig || isUpdatingSiteUrl || !siteUrlForm.formState.isDirty}- loading={isUpdatingSiteUrl}- >- Save changes- </Button>- </CardFooter>- </Card>- </form>- </Form_Shadcn_>- </ScaffoldSection>+ </CardFooter>+ </Card>+ </form>+ </Form_Shadcn_>+ </PageSectionContent>+ </PageSection>)}diff --git a/apps/studio/components/interfaces/Auth/SmtpForm/SmtpForm.tsx b/apps/studio/components/interfaces/Auth/SmtpForm/SmtpForm.tsxindex c8fc282d053..90abb84ebbe 100644--- a/apps/studio/components/interfaces/Auth/SmtpForm/SmtpForm.tsx+++ b/apps/studio/components/interfaces/Auth/SmtpForm/SmtpForm.tsx@@ -7,7 +7,6 @@ import { toast } from 'sonner'import * as yup from 'yup'import { useParams } from 'common'-import { ScaffoldSection } from 'components/layouts/Scaffold'import AlertError from 'components/ui/AlertError'import { InlineLink } from 'components/ui/InlineLink'import NoPermission from 'components/ui/NoPermission'@@ -27,7 +26,7 @@ import {Switch,cn,} from 'ui'-import { Admonition } from 'ui-patterns'+import { Admonition, PageSection, PageSectionContent } from 'ui-patterns'import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'import { urlRegex } from '../Auth.constants'import { defaultDisabledSmtpFormValues } from './SmtpForm.constants'@@ -187,307 +186,316 @@ export const SmtpForm = () => {if (isError) {return (- <ScaffoldSection isFullWidth>- <AlertError error={authConfigError} subject="Failed to retrieve auth configuration" />- </ScaffoldSection>+ <PageSection>+ <PageSectionContent>+ <AlertError error={authConfigError} subject="Failed to retrieve auth configuration" />+ </PageSectionContent>+ </PageSection>)}if (!canReadConfig) {return (- <ScaffoldSection isFullWidth>- <NoPermission resourceText="view SMTP settings" />- </ScaffoldSection>+ <PageSection>+ <PageSectionContent>+ <NoPermission resourceText="view SMTP settings" />+ </PageSectionContent>+ </PageSection>)}return (- <ScaffoldSection isFullWidth>- <Form_Shadcn_ {...form}>- <form onSubmit={form.handleSubmit(onSubmit)}>- <Card>- <CardContent>- <FormField_Shadcn_- control={form.control}- name="ENABLE_SMTP"- render={({ field }) => (- <FormItemLayout- layout="flex-row-reverse"- label="Enable custom SMTP"- description={- <p className="max-w-full prose text-sm text-foreground-lighter">- Emails will be sent using your custom SMTP provider. Email rate limits can- be adjusted{' '}- <InlineLink href={`/project/${projectRef}/auth/rate-limits`}>- here- </InlineLink>- .- </p>- }- >- <FormControl_Shadcn_>- <Switch- checked={field.value}- onCheckedChange={field.onChange}- disabled={!canUpdateConfig}- />- </FormControl_Shadcn_>- </FormItemLayout>- )}- />-- {enableSmtp && !isSmtpEnabled(form.getValues() as any) && (- <Admonition- type="warning"- title="All fields must be filled"- description="Each of the fields below must be filled before custom SMTP can be enabled."- className="bg-warning-200 border-warning-400 mt-4"+ <PageSection>+ <PageSectionContent>+ <Form_Shadcn_ {...form}>+ <form onSubmit={form.handleSubmit(onSubmit)}>+ <Card>+ <CardContent>+ <FormField_Shadcn_+ control={form.control}+ name="ENABLE_SMTP"+ render={({ field }) => (+ <FormItemLayout+ layout="flex-row-reverse"+ label="Enable custom SMTP"+ description={+ <p className="max-w-full prose text-sm text-foreground-lighter">+ Emails will be sent using your custom SMTP provider. Email rate limits can+ be adjusted{' '}+ <InlineLink href={`/project/${projectRef}/auth/rate-limits`}>+ here+ </InlineLink>+ .+ </p>+ }+ >+ <FormControl_Shadcn_>+ <Switch+ checked={field.value}+ onCheckedChange={field.onChange}+ disabled={!canUpdateConfig}+ />+ </FormControl_Shadcn_>+ </FormItemLayout>+ )}/>- )}- </CardContent>- {enableSmtp && (- <>- <CardContent className="py-6">- <div className="grid grid-cols-12 gap-6">- <div className="col-span-4">- <h3 className="text-sm mb-1">Sender details</h3>- <p className="text-sm text-foreground-lighter text-balance">- Configure the sender information for your emails.- </p>- </div>- <div className="col-span-8 space-y-4">- <FormField_Shadcn_- control={form.control}- name="SMTP_ADMIN_EMAIL"- render={({ field }) => (- <FormItemLayout- label="Sender email address"- description="The email address the emails are sent from."- >- <FormControl_Shadcn_>- <Input_Shadcn_- {...field}- placeholder="[email protected]"- disabled={!canUpdateConfig}- />- </FormControl_Shadcn_>- </FormItemLayout>- )}- />+ {enableSmtp && !isSmtpEnabled(form.getValues() as any) && (+ <Admonition+ type="warning"+ title="All fields must be filled"+ description="Each of the fields below must be filled before custom SMTP can be enabled."+ className="bg-warning-200 border-warning-400 mt-4"+ />+ )}+ </CardContent>- <FormField_Shadcn_- control={form.control}- name="SMTP_SENDER_NAME"- render={({ field }) => (- <FormItemLayout- label="Sender name"- description="Name displayed in the recipient's inbox."- >- <FormControl_Shadcn_>- <Input_Shadcn_- {...field}- placeholder="Your Name"- disabled={!canUpdateConfig}- />- </FormControl_Shadcn_>- </FormItemLayout>- )}- />- </div>- </div>- </CardContent>+ {enableSmtp && (+ <>+ <CardContent className="py-6">+ <div className="grid grid-cols-12 gap-6">+ <div className="col-span-4">+ <h3 className="text-sm mb-1">Sender details</h3>+ <p className="text-sm text-foreground-lighter text-balance">+ Configure the sender information for your emails.+ </p>+ </div>+ <div className="col-span-8 space-y-4">+ <FormField_Shadcn_+ control={form.control}+ name="SMTP_ADMIN_EMAIL"+ render={({ field }) => (+ <FormItemLayout+ label="Sender email address"+ description="The email address the emails are sent from."+ >+ <FormControl_Shadcn_>+ <Input_Shadcn_+ {...field}+ placeholder="[email protected]"+ disabled={!canUpdateConfig}+ />+ </FormControl_Shadcn_>+ </FormItemLayout>+ )}+ />- <CardContent className="py-6">- <div className="grid grid-cols-12 gap-6">- <div className="col-span-4">- <h3 className="text-sm mb-1">SMTP provider settings</h3>- <p className="text-sm text-foreground-lighter text-balance">- Your SMTP credentials will always be encrypted in our database.- </p>+ <FormField_Shadcn_+ control={form.control}+ name="SMTP_SENDER_NAME"+ render={({ field }) => (+ <FormItemLayout+ label="Sender name"+ description="Name displayed in the recipient's inbox."+ >+ <FormControl_Shadcn_>+ <Input_Shadcn_+ {...field}+ placeholder="Your Name"+ disabled={!canUpdateConfig}+ />+ </FormControl_Shadcn_>+ </FormItemLayout>+ )}+ />+ </div></div>- <div className="col-span-8 space-y-4">- <FormField_Shadcn_- control={form.control}- name="SMTP_HOST"- render={({ field }) => (- <FormItemLayout- label="Host"- description="Hostname or IP address of your SMTP server."- >- <FormControl_Shadcn_>- <Input_Shadcn_- {...field}- placeholder="your.smtp.host.com"- disabled={!canUpdateConfig}- />- </FormControl_Shadcn_>- </FormItemLayout>- )}- />+ </CardContent>- {form.watch('SMTP_HOST')?.endsWith('.gmail.com') && (- <Admonition- type="warning"- title="Check your SMTP provider"- description="It looks like the SMTP provider you entered is designed- for sending personal rather than transactional email messages. Email deliverability may- be impacted."- className="mb-4 bg-warning-200 border-warning-400"+ <CardContent className="py-6">+ <div className="grid grid-cols-12 gap-6">+ <div className="col-span-4">+ <h3 className="text-sm mb-1">SMTP provider settings</h3>+ <p className="text-sm text-foreground-lighter text-balance">+ Your SMTP credentials will always be encrypted in our database.+ </p>+ </div>+ <div className="col-span-8 space-y-4">+ <FormField_Shadcn_+ control={form.control}+ name="SMTP_HOST"+ render={({ field }) => (+ <FormItemLayout+ label="Host"+ description="Hostname or IP address of your SMTP server."+ >+ <FormControl_Shadcn_>+ <Input_Shadcn_+ {...field}+ placeholder="your.smtp.host.com"+ disabled={!canUpdateConfig}+ />+ </FormControl_Shadcn_>+ </FormItemLayout>+ )}/>- )}- <FormField_Shadcn_- control={form.control}- name="SMTP_PORT"- render={({ field }) => (- <FormItemLayout- label="Port number"- description={- <>- <span className="block">- Port used by your SMTP server. Common ports include 465 and 587.- Avoid using port 25 as it is often blocked by providers to curb- spam.- </span>- </>- }- >- <FormControl_Shadcn_>- <Input_Shadcn_- type="number"- value={field.value}- onChange={(e) => field.onChange(Number(e.target.value))}- placeholder="587"- disabled={!canUpdateConfig}- />- </FormControl_Shadcn_>- </FormItemLayout>+ {form.watch('SMTP_HOST')?.endsWith('.gmail.com') && (+ <Admonition+ type="warning"+ title="Check your SMTP provider"+ description="It looks like the SMTP provider you entered is designed+ for sending personal rather than transactional email messages. Email deliverability may+ be impacted."+ className="mb-4 bg-warning-200 border-warning-400"+ />)}- />- <FormField_Shadcn_- control={form.control}- name="SMTP_MAX_FREQUENCY"- render={({ field }) => (- <FormItemLayout- label="Minimum interval per user"- description="The minimum time in seconds between emails before another email can be sent to the same user."- >- <FormControl_Shadcn_>- <PrePostTab postTab="seconds">+ <FormField_Shadcn_+ control={form.control}+ name="SMTP_PORT"+ render={({ field }) => (+ <FormItemLayout+ label="Port number"+ description={+ <>+ <span className="block">+ Port used by your SMTP server. Common ports include 465 and 587.+ Avoid using port 25 as it is often blocked by providers to curb+ spam.+ </span>+ </>+ }+ >+ <FormControl_Shadcn_><Input_Shadcn_type="number"value={field.value}onChange={(e) => field.onChange(Number(e.target.value))}+ placeholder="587"disabled={!canUpdateConfig}/>- </PrePostTab>- </FormControl_Shadcn_>- </FormItemLayout>- )}- />-- <FormField_Shadcn_- control={form.control}- name="SMTP_USER"- render={({ field }) => (- <FormItemLayout- label="Username"- description="Username for your SMTP server."- >- <FormControl_Shadcn_>- <Input_Shadcn_- {...field}- placeholder="SMTP Username"- disabled={!canUpdateConfig}- />- </FormControl_Shadcn_>- </FormItemLayout>- )}- />+ </FormControl_Shadcn_>+ </FormItemLayout>+ )}+ />- <FormField_Shadcn_- control={form.control}- name="SMTP_PASS"- render={({ field }) => (- <FormItemLayout- label="Password"- description="Password for your SMTP server. For security reasons, this password cannot be viewed once saved."- >- <FormControl_Shadcn_>- <PrePostTab- postTab={- <Button- type="text"- className="p-0"- onClick={() => setHidden(!hidden)}- icon={hidden ? <Eye /> : <EyeOff />}+ <FormField_Shadcn_+ control={form.control}+ name="SMTP_MAX_FREQUENCY"+ render={({ field }) => (+ <FormItemLayout+ label="Minimum interval per user"+ description="The minimum time in seconds between emails before another email can be sent to the same user."+ >+ <FormControl_Shadcn_>+ <PrePostTab postTab="seconds">+ <Input_Shadcn_+ type="number"+ value={field.value}+ onChange={(e) => field.onChange(Number(e.target.value))}+ disabled={!canUpdateConfig}/>- }- >+ </PrePostTab>+ </FormControl_Shadcn_>+ </FormItemLayout>+ )}+ />++ <FormField_Shadcn_+ control={form.control}+ name="SMTP_USER"+ render={({ field }) => (+ <FormItemLayout+ label="Username"+ description="Username for your SMTP server."+ >+ <FormControl_Shadcn_><Input_Shadcn_{...field}- type={hidden ? 'password' : 'text'}- placeholder={- authConfig?.SMTP_PASS === null ? 'SMTP Password' : '••••••••'- }+ placeholder="SMTP Username"disabled={!canUpdateConfig}/>- </PrePostTab>- </FormControl_Shadcn_>- </FormItemLayout>- )}- />- </div>- </div>- </CardContent>- </>- )}+ </FormControl_Shadcn_>+ </FormItemLayout>+ )}+ />- <CardFooter- className={cn(form.formState.isDirty ? 'justify-between' : 'justify-end', 'gap-x-2')}- >- {form.formState.isDirty && (- <p className="text-sm text-foreground-light">- {enableSmtp ? (- <>- Rate limit for sending emails will be increased to 30 and{' '}- <InlineLink href={`/project/${projectRef}/auth/rate-limits`}>- can be adjusted- </InlineLink>{' '}- after enabling custom SMTP- </>- ) : (- 'Rate limit for sending emails will be reduced to 2 after disabling custom SMTP'- )}- </p>+ <FormField_Shadcn_+ control={form.control}+ name="SMTP_PASS"+ render={({ field }) => (+ <FormItemLayout+ label="Password"+ description="Password for your SMTP server. For security reasons, this password cannot be viewed once saved."+ >+ <FormControl_Shadcn_>+ <PrePostTab+ postTab={+ <Button+ type="text"+ className="p-0"+ onClick={() => setHidden(!hidden)}+ icon={hidden ? <Eye /> : <EyeOff />}+ />+ }+ >+ <Input_Shadcn_+ {...field}+ type={hidden ? 'password' : 'text'}+ placeholder={+ authConfig?.SMTP_PASS === null ? 'SMTP Password' : '••••••••'+ }+ disabled={!canUpdateConfig}+ />+ </PrePostTab>+ </FormControl_Shadcn_>+ </FormItemLayout>+ )}+ />+ </div>+ </div>+ </CardContent>+ </>)}- <div className="flex items-center gap-x-2">++ <CardFooter+ className={cn(+ form.formState.isDirty ? 'justify-between' : 'justify-end',+ 'gap-x-2'+ )}+ >{form.formState.isDirty && (+ <p className="text-sm text-foreground-light">+ {enableSmtp ? (+ <>+ Rate limit for sending emails will be increased to 30 and{' '}+ <InlineLink href={`/project/${projectRef}/auth/rate-limits`}>+ can be adjusted+ </InlineLink>{' '}+ after enabling custom SMTP+ </>+ ) : (+ 'Rate limit for sending emails will be reduced to 2 after disabling custom SMTP'+ )}+ </p>+ )}+ <div className="flex items-center gap-x-2">+ {form.formState.isDirty && (+ <Button+ type="default"+ onClick={() => {+ form.reset()+ setEnableSmtp(isSmtpEnabled(authConfig))+ }}+ >+ Cancel+ </Button>+ )}<Button- type="default"- onClick={() => {- form.reset()- setEnableSmtp(isSmtpEnabled(authConfig))- }}+ type="primary"+ htmlType="submit"+ loading={isUpdatingConfig}+ disabled={!canUpdateConfig || !form.formState.isDirty}>- Cancel+ Save changes</Button>- )}- <Button- type="primary"- htmlType="submit"- loading={isUpdatingConfig}- disabled={!canUpdateConfig || !form.formState.isDirty}- >- Save changes- </Button>- </div>- </CardFooter>- </Card>- </form>- </Form_Shadcn_>- </ScaffoldSection>+ </div>+ </CardFooter>+ </Card>+ </form>+ </Form_Shadcn_>+ </PageSectionContent>+ </PageSection>)}diff --git a/apps/studio/components/interfaces/Auth/ThirdPartyAuthForm/index.tsx b/apps/studio/components/interfaces/Auth/ThirdPartyAuthForm/index.tsxindex 99890c35aaf..416033c66f1 100644--- a/apps/studio/components/interfaces/Auth/ThirdPartyAuthForm/index.tsx+++ b/apps/studio/components/interfaces/Auth/ThirdPartyAuthForm/index.tsx@@ -4,11 +4,6 @@ import { useState } from 'react'import { toast } from 'sonner'import { useParams } from 'common'-import {- ScaffoldSection,- ScaffoldSectionDescription,- ScaffoldSectionTitle,-} from 'components/layouts/Scaffold'import AlertError from 'components/ui/AlertError'import { DocsButton } from 'components/ui/DocsButton'import { InlineLink } from 'components/ui/InlineLink'@@ -21,6 +16,15 @@ import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions'import { DOCS_URL } from 'lib/constants'import { cn } from 'ui'import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal'+import {+ PageSection,+ PageSectionAside,+ PageSectionContent,+ PageSectionDescription,+ PageSectionMeta,+ PageSectionSummary,+ PageSectionTitle,+} from 'ui-patterns/PageSection'import { AddIntegrationDropdown } from './AddIntegrationDropdown'import { CreateAuth0IntegrationDialog } from './CreateAuth0Dialog'import { CreateAwsCognitoAuthIntegrationDialog } from './CreateAwsCognitoAuthDialog'@@ -65,11 +69,11 @@ export const ThirdPartyAuthForm = () => {}return (- <ScaffoldSection isFullWidth>- <div className="flex justify-between gap-4">- <div>- <ScaffoldSectionTitle>Third Party Auth</ScaffoldSectionTitle>- <ScaffoldSectionDescription className="mb-6">+ <PageSection>+ <PageSectionMeta>+ <PageSectionSummary>+ <PageSectionTitle>Third Party Auth</PageSectionTitle>+ <PageSectionDescription>Use third-party authentication (TPA) systems based on JWTs to access your project.<br />Billing is based on the number of monthly active users (MAUs) requesting your API@@ -80,120 +84,124 @@ export const ThirdPartyAuthForm = () => {billing docs</InlineLink>{' '}for more information.- </ScaffoldSectionDescription>- </div>- <div className="flex items-center gap-2 ">- <DocsButton href={`${DOCS_URL}/guides/auth/third-party/overview`} />- {integrations.length !== 0 && (- <AddIntegrationDropdown onSelectIntegrationType={setSelectedIntegration} />- )}- </div>- </div>-- {isLoading && (- <div- className={cn(- 'border rounded border-default px-20 py-16 flex flex-col items-center justify-center space-y-4'- )}- >- <Loader2 size={24} className="animate-spin" />- </div>- )}-- {isSuccess ? (- integrations.length === 0 ? (+ </PageSectionDescription>+ </PageSectionSummary>+ <PageSectionAside>+ <div className="flex items-center gap-2">+ <DocsButton href={`${DOCS_URL}/guides/auth/third-party/overview`} />+ {integrations.length !== 0 && (+ <AddIntegrationDropdown onSelectIntegrationType={setSelectedIntegration} />+ )}+ </div>+ </PageSectionAside>+ </PageSectionMeta>+ <PageSectionContent>+ {isLoading && (<divclassName={cn('border rounded border-default px-20 py-16 flex flex-col items-center justify-center space-y-4')}>- <p className="text-sm text-foreground-light">No providers configured yet</p>- <AddIntegrationDropdown- align="center"- buttonText="Add a new integration"- onSelectIntegrationType={setSelectedIntegration}- />- </div>- ) : (- <div className="-space-y-px">- {integrations.map((integration) => {- return (- <IntegrationCard- key={integration.id}- integration={integration}- canUpdateConfig={canUpdateConfig}- onDelete={() => {- setSelectedIntegrationForDeletion(integration)- }}- />- )- })}+ <Loader2 size={24} className="animate-spin" /></div>- )- ) : null}+ )}- <CreateFirebaseAuthIntegrationDialog- visible={selectedIntegration === 'firebase'}- onDelete={() => {}}- onClose={() => setSelectedIntegration(undefined)}- />+ {isSuccess ? (+ integrations.length === 0 ? (+ <div+ className={cn(+ 'border rounded border-default px-20 py-16 flex flex-col items-center justify-center space-y-4'+ )}+ >+ <p className="text-sm text-foreground-light">No providers configured yet</p>+ <AddIntegrationDropdown+ align="center"+ buttonText="Add a new integration"+ onSelectIntegrationType={setSelectedIntegration}+ />+ </div>+ ) : (+ <div className="-space-y-px">+ {integrations.map((integration) => {+ return (+ <IntegrationCard+ key={integration.id}+ integration={integration}+ canUpdateConfig={canUpdateConfig}+ onDelete={() => {+ setSelectedIntegrationForDeletion(integration)+ }}+ />+ )+ })}+ </div>+ )+ ) : null}- <CreateAwsCognitoAuthIntegrationDialog- visible={selectedIntegration === 'awsCognito'}- onDelete={() => {}}- onClose={() => setSelectedIntegration(undefined)}- />+ <CreateFirebaseAuthIntegrationDialog+ visible={selectedIntegration === 'firebase'}+ onDelete={() => {}}+ onClose={() => setSelectedIntegration(undefined)}+ />- <CreateAuth0IntegrationDialog- visible={selectedIntegration === 'auth0'}- onDelete={() => {}}- onClose={() => setSelectedIntegration(undefined)}- />+ <CreateAwsCognitoAuthIntegrationDialog+ visible={selectedIntegration === 'awsCognito'}+ onDelete={() => {}}+ onClose={() => setSelectedIntegration(undefined)}+ />- <CreateClerkAuthIntegrationDialog- visible={selectedIntegration === 'clerk'}- onDelete={() => {}}- onClose={() => setSelectedIntegration(undefined)}- />+ <CreateAuth0IntegrationDialog+ visible={selectedIntegration === 'auth0'}+ onDelete={() => {}}+ onClose={() => setSelectedIntegration(undefined)}+ />- <CreateWorkOSIntegrationDialog- visible={selectedIntegration === 'workos'}- onDelete={() => {}}- onClose={() => setSelectedIntegration(undefined)}- />+ <CreateClerkAuthIntegrationDialog+ visible={selectedIntegration === 'clerk'}+ onDelete={() => {}}+ onClose={() => setSelectedIntegration(undefined)}+ />- <ConfirmationModal- size="medium"- visible={!!selectedIntegrationForDeletion}- variant="destructive"- title="Confirm to delete integration"- confirmLabel="Delete"- confirmLabelLoading="Deleting"- onCancel={() => setSelectedIntegrationForDeletion(undefined)}- onConfirm={async () => {- if (!selectedIntegrationForDeletion) {- return- }- const type = getIntegrationType(selectedIntegrationForDeletion)- try {- await deleteIntegration({- projectRef: projectRef!,- tpaId: selectedIntegrationForDeletion.id,- })- toast.success(`Successfully deleted ${getIntegrationTypeLabel(type)}.`)- setSelectedIntegrationForDeletion(undefined)- setSelectedIntegration(undefined)- } catch (error) {- toast.error(`Failed to delete ${getIntegrationTypeLabel(type)}.`)- console.error(error)- }- }}- >- <p className="text-sm text-foreground-light">- Are you sure you want to delete the{' '}- {getIntegrationTypeLabel(getIntegrationType(selectedIntegrationForDeletion))} integration?- </p>- </ConfirmationModal>- </ScaffoldSection>+ <CreateWorkOSIntegrationDialog+ visible={selectedIntegration === 'workos'}+ onDelete={() => {}}+ onClose={() => setSelectedIntegration(undefined)}+ />++ <ConfirmationModal+ size="medium"+ visible={!!selectedIntegrationForDeletion}+ variant="destructive"+ title="Confirm to delete integration"+ confirmLabel="Delete"+ confirmLabelLoading="Deleting"+ onCancel={() => setSelectedIntegrationForDeletion(undefined)}+ onConfirm={async () => {+ if (!selectedIntegrationForDeletion) {+ return+ }+ const type = getIntegrationType(selectedIntegrationForDeletion)+ try {+ await deleteIntegration({+ projectRef: projectRef!,+ tpaId: selectedIntegrationForDeletion.id,+ })+ toast.success(`Successfully deleted ${getIntegrationTypeLabel(type)}.`)+ setSelectedIntegrationForDeletion(undefined)+ setSelectedIntegration(undefined)+ } catch (error) {+ toast.error(`Failed to delete ${getIntegrationTypeLabel(type)}.`)+ console.error(error)+ }+ }}+ >+ <p className="text-sm text-foreground-light">+ Are you sure you want to delete the{' '}+ {getIntegrationTypeLabel(getIntegrationType(selectedIntegrationForDeletion))}{' '}+ integration?+ </p>+ </ConfirmationModal>+ </PageSectionContent>+ </PageSection>)}