mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-17 06:58:19 +00:00
Compare commits
1 Commits
msg-delive
...
1.14.1-s.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e1fd4474f |
@@ -767,6 +767,8 @@ export default function ResourceAuthenticationPage() {
|
|||||||
<OneTimePasswordFormSection
|
<OneTimePasswordFormSection
|
||||||
resource={resource}
|
resource={resource}
|
||||||
updateResource={updateResource}
|
updateResource={updateResource}
|
||||||
|
whitelist={whitelist}
|
||||||
|
isLoadingWhiteList={isLoadingWhiteList}
|
||||||
/>
|
/>
|
||||||
</SettingsContainer>
|
</SettingsContainer>
|
||||||
</>
|
</>
|
||||||
@@ -776,11 +778,16 @@ export default function ResourceAuthenticationPage() {
|
|||||||
type OneTimePasswordFormSectionProps = Pick<
|
type OneTimePasswordFormSectionProps = Pick<
|
||||||
ResourceContextType,
|
ResourceContextType,
|
||||||
"resource" | "updateResource"
|
"resource" | "updateResource"
|
||||||
>;
|
> & {
|
||||||
|
whitelist: Array<{ email: string }>;
|
||||||
|
isLoadingWhiteList: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
function OneTimePasswordFormSection({
|
function OneTimePasswordFormSection({
|
||||||
resource,
|
resource,
|
||||||
updateResource
|
updateResource,
|
||||||
|
whitelist,
|
||||||
|
isLoadingWhiteList
|
||||||
}: OneTimePasswordFormSectionProps) {
|
}: OneTimePasswordFormSectionProps) {
|
||||||
const { env } = useEnvContext();
|
const { env } = useEnvContext();
|
||||||
const [whitelistEnabled, setWhitelistEnabled] = useState(
|
const [whitelistEnabled, setWhitelistEnabled] = useState(
|
||||||
@@ -801,6 +808,18 @@ function OneTimePasswordFormSection({
|
|||||||
number | null
|
number | null
|
||||||
>(null);
|
>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (isLoadingWhiteList) return;
|
||||||
|
|
||||||
|
whitelistForm.setValue(
|
||||||
|
"emails",
|
||||||
|
whitelist.map((w) => ({
|
||||||
|
id: w.email,
|
||||||
|
text: w.email
|
||||||
|
}))
|
||||||
|
);
|
||||||
|
}, [isLoadingWhiteList, whitelist, whitelistForm]);
|
||||||
|
|
||||||
async function saveWhitelist() {
|
async function saveWhitelist() {
|
||||||
try {
|
try {
|
||||||
await api.post(`/resource/${resource.resourceId}`, {
|
await api.post(`/resource/${resource.resourceId}`, {
|
||||||
|
|||||||
Reference in New Issue
Block a user