diff --git a/src/app/[orgId]/settings/resources/proxy/[niceId]/authentication/page.tsx b/src/app/[orgId]/settings/resources/proxy/[niceId]/authentication/page.tsx index 968b2700..a7224461 100644 --- a/src/app/[orgId]/settings/resources/proxy/[niceId]/authentication/page.tsx +++ b/src/app/[orgId]/settings/resources/proxy/[niceId]/authentication/page.tsx @@ -767,6 +767,8 @@ export default function ResourceAuthenticationPage() { @@ -776,11 +778,16 @@ export default function ResourceAuthenticationPage() { type OneTimePasswordFormSectionProps = Pick< ResourceContextType, "resource" | "updateResource" ->; +> & { + whitelist: Array<{ email: string }>; + isLoadingWhiteList: boolean; +}; function OneTimePasswordFormSection({ resource, - updateResource + updateResource, + whitelist, + isLoadingWhiteList }: OneTimePasswordFormSectionProps) { const { env } = useEnvContext(); const [whitelistEnabled, setWhitelistEnabled] = useState( @@ -801,6 +808,18 @@ function OneTimePasswordFormSection({ number | null >(null); + useEffect(() => { + if (isLoadingWhiteList) return; + + whitelistForm.setValue( + "emails", + whitelist.map((w) => ({ + id: w.email, + text: w.email + })) + ); + }, [isLoadingWhiteList, whitelist, whitelistForm]); + async function saveWhitelist() { try { await api.post(`/resource/${resource.resourceId}`, {