mirror of
https://github.com/supabase/supabase.git
synced 2026-07-05 19:15:02 +08:00
fix: update auth settings with new gotrue configs
This commit is contained in:
@@ -34,6 +34,7 @@ const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
JWT_DEFAULT_GROUP_NAME: '',
|
||||
URI_ALLOW_LIST: '',
|
||||
MAILER_AUTOCONFIRM: false,
|
||||
MAILER_OTP_EXP: 86400,
|
||||
MAILER_URLPATHS_INVITE: '',
|
||||
MAILER_URLPATHS_CONFIRMATION: '',
|
||||
MAILER_URLPATHS_RECOVERY: '',
|
||||
@@ -127,8 +128,8 @@ const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
SMTP_SENDER_NAME: null,
|
||||
SMS_AUTOCONFIRM: false,
|
||||
SMS_MAX_FREQUENCY: 0,
|
||||
SMS_OTP_EXP: 0,
|
||||
SMS_OTP_LENGTH: 0,
|
||||
SMS_OTP_EXP: 60,
|
||||
SMS_OTP_LENGTH: 6,
|
||||
SMS_PROVIDER: 'twilio',
|
||||
SMS_TWILIO_ACCOUNT_SID: null,
|
||||
SMS_TWILIO_AUTH_TOKEN: null,
|
||||
@@ -137,6 +138,7 @@ const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
SECURITY_CAPTCHA_ENABLED: false,
|
||||
SECURITY_CAPTCHA_PROVIDER: 'hcaptcha',
|
||||
SECURITY_CAPTCHA_SECRET: null,
|
||||
SECURITY_REFRESH_TOKEN_REUSE_INTERVAL: '10',
|
||||
RATE_LIMIT_EMAIL_SENT: 0,
|
||||
MAILER_SECURE_EMAIL_CHANGE_ENABLED: true,
|
||||
SMS_MESSAGEBIRD_ACCESS_KEY: null,
|
||||
|
||||
@@ -14,7 +14,6 @@ import { pluckJsonSchemaFields } from 'lib/helpers'
|
||||
import { AuthLayout } from 'components/layouts'
|
||||
import Table from 'components/to-be-cleaned/Table'
|
||||
import Panel from 'components/to-be-cleaned/Panel'
|
||||
import Toggle from 'components/to-be-cleaned/forms/Toggle'
|
||||
import ToggleField from 'components/to-be-cleaned/forms/ToggleField'
|
||||
import SecretField from 'components/to-be-cleaned/forms/SecretField'
|
||||
import SchemaFormPanel from 'components/to-be-cleaned/forms/SchemaFormPanel'
|
||||
@@ -122,6 +121,7 @@ const Settings = () => {
|
||||
'DISABLE_SIGNUP',
|
||||
'PASSWORD_MIN_LENGTH',
|
||||
'SECURITY_UPDATE_PASSWORD_REQUIRE_REAUTHENTICATION',
|
||||
'SECURITY_REFRESH_TOKEN_REUSE_INTERVAL',
|
||||
])}
|
||||
model={{
|
||||
SITE_URL: model.SITE_URL || undefined,
|
||||
@@ -130,6 +130,7 @@ const Settings = () => {
|
||||
JWT_EXP: model.JWT_EXP || undefined,
|
||||
PASSWORD_MIN_LENGTH: model.PASSWORD_MIN_LENGTH || undefined,
|
||||
SECURITY_UPDATE_PASSWORD_REQUIRE_REAUTHENTICATION: model.SECURITY_UPDATE_PASSWORD_REQUIRE_REAUTHENTICATION || false,
|
||||
SECURITY_REFRESH_TOKEN_REUSE_INTERVAL: model.SECURITY_REFRESH_TOKEN_REUSE_INTERVAL || undefined,
|
||||
}}
|
||||
onSubmit={(model: any) => onFormSubmit(model)}
|
||||
>
|
||||
@@ -144,8 +145,9 @@ const Settings = () => {
|
||||
errorMessage="Must be a comma separated list of exact URIs. No spaces."
|
||||
/>
|
||||
<NumField name="JWT_EXP" step="1" />
|
||||
<NumField name="PASSWORD_MIN_LENGTH" step="1" />
|
||||
<NumField name="PASSWORD_MIN_LENGTH" step="1" min={6} max={10} />
|
||||
<ToggleField name="SECURITY_UPDATE_PASSWORD_REQUIRE_REAUTHENTICATION" />
|
||||
<NumField name="SECURITY_REFRESH_TOKEN_REUSE_INTERVAL" step="1" min={0}/>
|
||||
<ToggleField name="DISABLE_SIGNUP" />
|
||||
</SchemaFormPanel>
|
||||
</div>
|
||||
@@ -154,6 +156,7 @@ const Settings = () => {
|
||||
title="Email Auth"
|
||||
schema={pluckJsonSchemaFields(authConfig, [
|
||||
'MAILER_SECURE_EMAIL_CHANGE_ENABLED',
|
||||
'MAILER_OTP_EXP',
|
||||
'SMTP_ADMIN_EMAIL',
|
||||
'SMTP_HOST',
|
||||
'SMTP_PORT',
|
||||
@@ -164,6 +167,7 @@ const Settings = () => {
|
||||
])}
|
||||
model={{
|
||||
MAILER_SECURE_EMAIL_CHANGE_ENABLED: model.MAILER_SECURE_EMAIL_CHANGE_ENABLED,
|
||||
MAILER_OTP_EXP: model.MAILER_OTP_EXP || undefined,
|
||||
SMTP_ADMIN_EMAIL: isCustomSMTPEnabled ? model.SMTP_ADMIN_EMAIL : '',
|
||||
SMTP_HOST: isCustomSMTPEnabled ? model.SMTP_HOST : '',
|
||||
SMTP_PORT: isCustomSMTPEnabled ? model.SMTP_PORT : '',
|
||||
@@ -188,7 +192,7 @@ const Settings = () => {
|
||||
checked={model.EXTERNAL_EMAIL_ENABLED}
|
||||
descriptionText={authConfig.properties.EXTERNAL_EMAIL_ENABLED.help}
|
||||
/>
|
||||
|
||||
<NumField name="MAILER_OTP_EXP" step="1" min={0} max={86400}/>
|
||||
<UIToggle
|
||||
layout="horizontal"
|
||||
className="mb-4"
|
||||
@@ -269,6 +273,8 @@ const Settings = () => {
|
||||
title="Phone Auth"
|
||||
schema={pluckJsonSchemaFields(authConfig, [
|
||||
'SMS_PROVIDER',
|
||||
'SMS_OTP_EXP',
|
||||
'SMS_OTP_LENGTH',
|
||||
'SMS_TWILIO_ACCOUNT_SID',
|
||||
'SMS_TWILIO_AUTH_TOKEN',
|
||||
'SMS_TWILIO_MESSAGE_SERVICE_SID',
|
||||
@@ -282,6 +288,8 @@ const Settings = () => {
|
||||
])}
|
||||
model={{
|
||||
SMS_PROVIDER: model.SMS_PROVIDER,
|
||||
SMS_OTP_EXP: model.SMS_OTP_EXP || undefined,
|
||||
SMS_OTP_LENGTH: model.SMS_OTP_LENGTH || undefined,
|
||||
SMS_TEXTLOCAL_API_KEY: model.SMS_TEXTLOCAL_API_KEY || undefined,
|
||||
SMS_TEXTLOCAL_SENDER: model.SMS_TEXTLOCAL_SENDER || undefined,
|
||||
SMS_TWILIO_ACCOUNT_SID: model.SMS_TWILIO_ACCOUNT_SID || undefined,
|
||||
@@ -315,6 +323,8 @@ const Settings = () => {
|
||||
showInlineError
|
||||
errorMessage="Please enter the phone provider."
|
||||
/>
|
||||
<NumField name="SMS_OTP_EXP" step="1" min={0}/>
|
||||
<NumField name="SMS_OTP_LENGTH" step="1" min={6} max={10}/>
|
||||
{smsProviderModel?.SMS_PROVIDER === 'messagebird' ? (
|
||||
<>
|
||||
<SecretField
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
"SMS_PROVIDER",
|
||||
"SMS_TEMPLATE",
|
||||
"MAILER_AUTOCONFIRM",
|
||||
"MAILER_OTP_EXP",
|
||||
"MAILER_URLPATHS_INVITE",
|
||||
"MAILER_URLPATHS_CONFIRMATION",
|
||||
"MAILER_URLPATHS_RECOVERY",
|
||||
@@ -376,6 +377,12 @@
|
||||
"title": "Subject",
|
||||
"type": "string"
|
||||
},
|
||||
"MAILER_OTP_EXP": {
|
||||
"title": "Mailer Otp Expiration",
|
||||
"type": "integer",
|
||||
"help": "Duration before an email otp / link expires."
|
||||
},
|
||||
|
||||
"MAILER_SUBJECTS_CONFIRMATION": {
|
||||
"title": "Subject",
|
||||
"type": "string"
|
||||
@@ -436,11 +443,26 @@
|
||||
"type": "boolean",
|
||||
"help": "If enabled, users need to reauthenticate via email or phone before updating their passwords."
|
||||
},
|
||||
"SECURITY_REFRESH_TOKEN_REUSE_INTERVAL": {
|
||||
"title": "Reuse Interval",
|
||||
"type": "integer",
|
||||
"help": "Time interval where the same refresh token can be used to request for an access token."
|
||||
},
|
||||
"SMS_AUTOCONFIRM": {
|
||||
"title": "Enable phone confirmations",
|
||||
"type": "boolean",
|
||||
"help": "If enabled, users need to confirm their phone number before signing in."
|
||||
},
|
||||
"SMS_OTP_EXP": {
|
||||
"title": "Sms Otp Expiration",
|
||||
"type": "integer",
|
||||
"help": "Duration before an sms otp expires."
|
||||
},
|
||||
"SMS_OTP_LENGTH": {
|
||||
"title": "Sms Otp Length",
|
||||
"type": "integer",
|
||||
"help": "Number of digits in otp."
|
||||
},
|
||||
"SMS_PROVIDER": {
|
||||
"title": "Sms provider",
|
||||
"type": "string",
|
||||
|
||||
Reference in New Issue
Block a user