diff --git a/src/Common/Constants.ts b/src/Common/Constants.ts index ff121f3a5..cb4c8f007 100644 --- a/src/Common/Constants.ts +++ b/src/Common/Constants.ts @@ -133,6 +133,7 @@ export enum MongoBackendEndpointType { export class BackendApi { public static readonly GenerateToken: string = "GenerateToken"; public static readonly PortalSettings: string = "PortalSettings"; + public static readonly AccountRestrictions: string = "AccountRestrictions"; } export class PortalBackendEndpoints { diff --git a/src/Platform/Hosted/Components/ConnectExplorer.tsx b/src/Platform/Hosted/Components/ConnectExplorer.tsx index 513247a6c..64f8540b7 100644 --- a/src/Platform/Hosted/Components/ConnectExplorer.tsx +++ b/src/Platform/Hosted/Components/ConnectExplorer.tsx @@ -51,13 +51,18 @@ export const fetchEncryptedToken_ToBeDeprecated = async (connectionString: strin export const isAccountRestrictedForConnectionStringLogin = async (connectionString: string): Promise => { const headers = new Headers(); headers.append(HttpHeaders.connectionString, connectionString); - const url = configContext.BACKEND_ENDPOINT + "/api/guest/accountrestrictions/checkconnectionstringlogin"; + + const backendEndpoint: string = useNewPortalBackendEndpoint(BackendApi.PortalSettings) + ? configContext.PORTAL_BACKEND_ENDPOINT + : configContext.BACKEND_ENDPOINT; + + const url = backendEndpoint + "/api/guest/accountrestrictions/checkconnectionstringlogin"; const response = await fetch(url, { headers, method: "POST" }); if (!response.ok) { throw response; } - return (await response.text()) === "True"; + return (await response.text()).toLowerCase() === "true"; }; export const ConnectExplorer: React.FunctionComponent = ({ diff --git a/src/Utils/EndpointUtils.ts b/src/Utils/EndpointUtils.ts index 97e733b98..b685dc71a 100644 --- a/src/Utils/EndpointUtils.ts +++ b/src/Utils/EndpointUtils.ts @@ -164,6 +164,7 @@ export function useNewPortalBackendEndpoint(backendApi: string): boolean { PortalBackendEndpoints.Mpac, PortalBackendEndpoints.Prod, ], + [BackendApi.AccountRestrictions]: [PortalBackendEndpoints.Development, PortalBackendEndpoints.Mpac], }; if (!newBackendApiEnvironmentMap[backendApi] || !configContext.PORTAL_BACKEND_ENDPOINT) {