The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat(account): require a user to name their TOTP authenticator (#48493)
fadymake6b872557149
diff --git a/apps/studio/components/interfaces/Account/TOTPFactors/AddNewFactorModal.tsx b/apps/studio/components/interfaces/Account/TOTPFactors/AddNewFactorModal.tsxindex 63c89019637..8b6ce19fb05 100644--- a/apps/studio/components/interfaces/Account/TOTPFactors/AddNewFactorModal.tsx+++ b/apps/studio/components/interfaces/Account/TOTPFactors/AddNewFactorModal.tsx@@ -59,25 +59,28 @@ interface FirstStepProps {onClose: () => void}+const ENROLL_FORM_ID = 'add-totp-factor-form'++const EnrollFormSchema = z.object({+ name: z.string().trim().min(1, 'Name is required'),+})+type EnrollFormValues = z.infer<typeof EnrollFormSchema>++const enrollFormDefaultValues: EnrollFormValues = { name: '' }+const FirstStep = ({ visible, isEnrolling, enroll, onClose }: FirstStepProps) => {- const FormSchema = z.object({- name: z.string().min(1, 'Please provide a name to identify this app'),- })- const form = useForm<z.infer<typeof FormSchema>>({- resolver: zodResolver(FormSchema),- defaultValues: { name: '' },+ const form = useForm<EnrollFormValues>({+ resolver: zodResolver(EnrollFormSchema),+ defaultValues: enrollFormDefaultValues,mode: 'onChange',})- const onSubmit: SubmitHandler<z.infer<typeof FormSchema>> = async (values) => {+ const onSubmit: SubmitHandler<EnrollFormValues> = async (values) => {enroll({ factorType: 'totp', friendlyName: values.name })}useEffect(() => {- if (!visible) {- // Generate a name with a number between 0 and 1000- form.reset({ name: `App ${Math.floor(Math.random() * 1000)}` })- }+ if (visible) form.reset(enrollFormDefaultValues)}, [form, visible])return (@@ -93,7 +96,7 @@ const FirstStep = ({ visible, isEnrolling, enroll, onClose }: FirstStepProps) =>><Form {...form}><form- id="verify-otp-form"+ id={ENROLL_FORM_ID}className="flex flex-col gap-4"onSubmit={form.handleSubmit(onSubmit)}>@@ -104,11 +107,11 @@ const FirstStep = ({ visible, isEnrolling, enroll, onClose }: FirstStepProps) =>render={({ field }) => (<FormItemLayoutname="name"- label="Provide a name to identify this app"- description="A string will be randomly generated if a name is not provided"+ label="Authenticator app name"+ description="Used to identify the app in your account settings and during sign-in."><FormControl>- <Input id="name" {...field} />+ <Input placeholder="e.g.: Google Authenticator" autoFocus {...field} /></FormControl></FormItemLayout>)}diff --git a/apps/studio/components/interfaces/Account/TOTPFactors/index.tsx b/apps/studio/components/interfaces/Account/TOTPFactors/index.tsxindex 28d2a728ee3..61c79ac6bec 100644--- a/apps/studio/components/interfaces/Account/TOTPFactors/index.tsx+++ b/apps/studio/components/interfaces/Account/TOTPFactors/index.tsx@@ -18,7 +18,7 @@ export const TOTPFactors = () => {<><section className="space-y-3"><p className="text-sm text-foreground-light">- Use an authenticator app (like 1Password or Authy) to verify your identity at sign-in.+ Use an authenticator app (like Google Authenticator or 1Password) to protect your account.</p><div>{isLoading && <GenericSkeletonLoader />}