Skip to content

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

chore(studio): auth settings form patterns (#41303)

Francesco Sansalvadore3b7a7e4455d0
diff --git a/apps/studio/components/interfaces/Auth/MfaAuthSettingsForm/MfaAuthSettingsForm.tsx b/apps/studio/components/interfaces/Auth/MfaAuthSettingsForm/MfaAuthSettingsForm.tsx
index 984bdb8f354..5656f35a24e 100644
--- a/apps/studio/components/interfaces/Auth/MfaAuthSettingsForm/MfaAuthSettingsForm.tsx
+++ b/apps/studio/components/interfaces/Auth/MfaAuthSettingsForm/MfaAuthSettingsForm.tsx
@@ -317,7 +317,7 @@ export const MfaAuthSettingsForm = () => {
<Form_Shadcn_ {...totpForm}>
<form onSubmit={totpForm.handleSubmit(onSubmitTotpForm)} className="space-y-4">
<Card>
- <CardContent className="pt-6">
+ <CardContent>
<FormField_Shadcn_
control={totpForm.control}
name="MFA_TOTP"
@@ -410,10 +410,9 @@ export const MfaAuthSettingsForm = () => {
e.preventDefault()
maybeConfirmPhoneMFAOrSubmit()
}}
- className="space-y-4"
>
<Card>
- <CardContent className="pt-6">
+ <CardContent>
<FormField_Shadcn_
control={phoneForm.control}
name="MFA_PHONE"
@@ -565,9 +564,9 @@ export const MfaAuthSettingsForm = () => {
</PageSectionMeta>
<PageSectionContent>
<Form_Shadcn_ {...securityForm}>
- <form onSubmit={securityForm.handleSubmit(onSubmitSecurityForm)} className="space-y-4">
+ <form onSubmit={securityForm.handleSubmit(onSubmitSecurityForm)}>
<Card>
- <CardContent className="pt-6">
+ <CardContent>
<FormField_Shadcn_
control={securityForm.control}
name="MFA_ALLOW_LOW_AAL"
diff --git a/apps/studio/components/interfaces/Auth/OAuthApps/OAuthServerSettingsForm.tsx b/apps/studio/components/interfaces/Auth/OAuthApps/OAuthServerSettingsForm.tsx
index 21976f4a0a8..bdbf02ccfab 100644
--- a/apps/studio/components/interfaces/Auth/OAuthApps/OAuthServerSettingsForm.tsx
+++ b/apps/studio/components/interfaces/Auth/OAuthApps/OAuthServerSettingsForm.tsx
@@ -186,9 +186,9 @@ export const OAuthServerSettingsForm = () => {
return (
<>
<Form_Shadcn_ {...form}>
- <form onSubmit={form.handleSubmit(onSubmit)} className="pb-10">
+ <form onSubmit={form.handleSubmit(onSubmit)}>
<Card>
- <CardContent className="flex flex-col py-6 gap-y-4">
+ <CardContent>
<FormField_Shadcn_
control={form.control}
name="OAUTH_SERVER_ENABLED"
@@ -220,9 +220,10 @@ export const OAuthServerSettingsForm = () => {
{/* Site URL and Authorization Path - Only show when OAuth Server is enabled */}
{form.watch('OAUTH_SERVER_ENABLED') && (
<>
- <CardContent className="flex flex-col py-6 gap-y-4">
+ <CardContent>
<FormItemLayout
label="Site URL"
+ layout="flex-row-reverse"
description={
<>
The base URL of your application, configured in{' '}
@@ -243,13 +244,15 @@ export const OAuthServerSettingsForm = () => {
placeholder="https://example.com"
/>
</FormItemLayout>
-
+ </CardContent>
+ <CardContent className="space-y-4">
<FormField_Shadcn_
control={form.control}
name="OAUTH_SERVER_AUTHORIZATION_PATH"
render={({ field }) => (
<FormItemLayout
label="Authorization Path"
+ layout="flex-row-reverse"
description="Path where you'll implement the OAuth authorization UI (consent screens)."
>
<FormControl_Shadcn_>
@@ -281,7 +284,7 @@ export const OAuthServerSettingsForm = () => {
)
})()}
</CardContent>
- <CardContent className="py-6">
+ <CardContent>
<FormField_Shadcn_
control={form.control}
name="OAUTH_SERVER_ALLOW_DYNAMIC_REGISTRATION"
diff --git a/apps/studio/components/interfaces/Auth/RateLimits/RateLimits.tsx b/apps/studio/components/interfaces/Auth/RateLimits/RateLimits.tsx
index 9be8f904234..2f7497d8b73 100644
--- a/apps/studio/components/interfaces/Auth/RateLimits/RateLimits.tsx
+++ b/apps/studio/components/interfaces/Auth/RateLimits/RateLimits.tsx
@@ -22,6 +22,7 @@ import {
FormField_Shadcn_,
Form_Shadcn_,
Input_Shadcn_,
+ PrePostTab,
Tooltip,
TooltipContent,
TooltipTrigger,
@@ -175,9 +176,9 @@ export const RateLimits = () => {
<PageSection>
<PageSectionContent>
<Form_Shadcn_ {...form}>
- <form className="space-y-4" onSubmit={form.handleSubmit(onSubmit)}>
+ <form onSubmit={form.handleSubmit(onSubmit)}>
<Card>
- <CardContent className="pt-6">
+ <CardContent>
<FormField_Shadcn_
control={form.control}
name="RATE_LIMIT_EMAIL_SENT"
@@ -190,13 +191,14 @@ export const RateLimits = () => {
<Tooltip>
<TooltipTrigger asChild>
<FormControl_Shadcn_>
- <Input_Shadcn_
- type="number"
- className="w-24"
- min={0}
- {...field}
- disabled={!canUpdateConfig || !canUpdateEmailLimit}
- />
+ <PrePostTab postTab="emails/h">
+ <Input_Shadcn_
+ type="number"
+ min={0}
+ {...field}
+ disabled={!canUpdateConfig || !canUpdateEmailLimit}
+ />
+ </PrePostTab>
</FormControl_Shadcn_>
</TooltipTrigger>
{!canUpdateConfig || !canUpdateEmailLimit ? (
@@ -257,13 +259,14 @@ export const RateLimits = () => {
<Tooltip>
<TooltipTrigger asChild>
<FormControl_Shadcn_>
- <Input_Shadcn_
- type="number"
- className="w-24"
- min={0}
- {...field}
- disabled={!canUpdateConfig || !canUpdateSMSRateLimit}
- />
+ <PrePostTab postTab="sms/h">
+ <Input_Shadcn_
+ type="number"
+ min={0}
+ {...field}
+ disabled={!canUpdateConfig || !canUpdateSMSRateLimit}
+ />
+ </PrePostTab>
</FormControl_Shadcn_>
</TooltipTrigger>
{!canUpdateConfig || !canUpdateSMSRateLimit ? (
@@ -302,13 +305,14 @@ export const RateLimits = () => {
<Tooltip>
<TooltipTrigger asChild>
<FormControl_Shadcn_>
- <Input_Shadcn_
- type="number"
- className="w-24"
- min={0}
- {...field}
- disabled={!canUpdateConfig}
- />
+ <PrePostTab postTab="requests/5 min">
+ <Input_Shadcn_
+ type="number"
+ min={0}
+ {...field}
+ disabled={!canUpdateConfig}
+ />
+ </PrePostTab>
</FormControl_Shadcn_>
</TooltipTrigger>
{!canUpdateConfig && (
@@ -345,13 +349,14 @@ export const RateLimits = () => {
<Tooltip>
<TooltipTrigger asChild>
<FormControl_Shadcn_>
- <Input_Shadcn_
- type="number"
- className="w-24"
- min={0}
- {...field}
- disabled={!canUpdateConfig}
- />
+ <PrePostTab postTab="requests/5 min">
+ <Input_Shadcn_
+ type="number"
+ min={0}
+ {...field}
+ disabled={!canUpdateConfig}
+ />
+ </PrePostTab>
</FormControl_Shadcn_>
</TooltipTrigger>
{!canUpdateConfig && (
@@ -388,13 +393,14 @@ export const RateLimits = () => {
<Tooltip>
<TooltipTrigger asChild>
<FormControl_Shadcn_>
- <Input_Shadcn_
- type="number"
- className="w-24"
- min={0}
- {...field}
- disabled={!canUpdateConfig || !canUpdateAnonymousUsersRateLimit}
- />
+ <PrePostTab postTab="requests/h">
+ <Input_Shadcn_
+ type="number"
+ min={0}
+ {...field}
+ disabled={!canUpdateConfig || !canUpdateAnonymousUsersRateLimit}
+ />
+ </PrePostTab>
</FormControl_Shadcn_>
</TooltipTrigger>
{!canUpdateConfig || !canUpdateAnonymousUsersRateLimit ? (
@@ -431,13 +437,14 @@ export const RateLimits = () => {
<Tooltip>
<TooltipTrigger asChild>
<FormControl_Shadcn_>
- <Input_Shadcn_
- type="number"
- className="w-24"
- min={0}
- {...field}
- disabled={!canUpdateConfig}
- />
+ <PrePostTab postTab="requests/5 min">
+ <Input_Shadcn_
+ type="number"
+ min={0}
+ {...field}
+ disabled={!canUpdateConfig}
+ />
+ </PrePostTab>
</FormControl_Shadcn_>
</TooltipTrigger>
{!canUpdateConfig && (
@@ -474,13 +481,14 @@ export const RateLimits = () => {
<Tooltip>
<TooltipTrigger asChild>
<FormControl_Shadcn_>
- <Input_Shadcn_
- type="number"
- className="w-24"
- min={0}
- {...field}
- disabled={!canUpdateConfig || !canUpdateWeb3RateLimit}
- />
+ <PrePostTab postTab="requests/5 min">
+ <Input_Shadcn_
+ type="number"
+ min={0}
+ {...field}
+ disabled={!canUpdateConfig || !canUpdateWeb3RateLimit}
+ />
+ </PrePostTab>
</FormControl_Shadcn_>
</TooltipTrigger>
{!canUpdateConfig || !canUpdateWeb3RateLimit ? (
diff --git a/apps/studio/components/interfaces/Auth/SessionsAuthSettingsForm/SessionsAuthSettingsForm.tsx b/apps/studio/components/interfaces/Auth/SessionsAuthSettingsForm/SessionsAuthSettingsForm.tsx
index 6c89d9ba3af..12bb244a6af 100644
--- a/apps/studio/components/interfaces/Auth/SessionsAuthSettingsForm/SessionsAuthSettingsForm.tsx
+++ b/apps/studio/components/interfaces/Auth/SessionsAuthSettingsForm/SessionsAuthSettingsForm.tsx
@@ -207,7 +207,7 @@ export const SessionsAuthSettingsForm = () => {
className="space-y-4"
>
<Card>
- <CardContent className="pt-6">
+ <CardContent>
<FormField_Shadcn_
control={refreshTokenForm.control}
name="REFRESH_TOKEN_ROTATION_ENABLED"
@@ -238,7 +238,7 @@ export const SessionsAuthSettingsForm = () => {
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_>
+ <FormControl_Shadcn_ className="w-full">
<PrePostTab postTab="seconds">
<Input_Shadcn_
type="number"
@@ -322,18 +322,16 @@ export const SessionsAuthSettingsForm = () => {
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>
+ <FormControl_Shadcn_ className="w-full">
+ <PrePostTab postTab={<HoursOrNeverText value={field.value || 0} />}>
+ <Input_Shadcn_
+ type="number"
+ min={0}
+ {...field}
+ disabled={!canUpdateConfig || !isProPlanAndUp}
+ />
+ </PrePostTab>
+ </FormControl_Shadcn_>
</FormItemLayout>
)}
/>
@@ -349,17 +347,16 @@ export const SessionsAuthSettingsForm = () => {
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>
+ <FormControl_Shadcn_ className="w-full">
+ <PrePostTab postTab={<HoursOrNeverText value={field.value || 0} />}>
+ <Input_Shadcn_
+ type="number"
+ {...field}
+ className="flex-1"
+ disabled={!canUpdateConfig || !isProPlanAndUp}
+ />
+ </PrePostTab>
+ </FormControl_Shadcn_>
</FormItemLayout>
)}
/>
diff --git a/apps/studio/components/interfaces/Auth/SiteUrl/SiteUrl.tsx b/apps/studio/components/interfaces/Auth/SiteUrl/SiteUrl.tsx
index 25a00e1235c..2f1710d1b5c 100644
--- a/apps/studio/components/interfaces/Auth/SiteUrl/SiteUrl.tsx
+++ b/apps/studio/components/interfaces/Auth/SiteUrl/SiteUrl.tsx
@@ -112,9 +112,9 @@ const SiteUrl = () => {
</PageSectionMeta>
<PageSectionContent>
<Form_Shadcn_ {...siteUrlForm}>
- <form onSubmit={siteUrlForm.handleSubmit(onSubmitSiteUrl)} className="space-y-4">
+ <form onSubmit={siteUrlForm.handleSubmit(onSubmitSiteUrl)}>
<Card>
- <CardContent className="pt-6">
+ <CardContent>
<FormField_Shadcn_
control={siteUrlForm.control}
name="SITE_URL"