diff --git a/ui/src/app/app.constants.ts b/ui/src/app/app.constants.ts index 7e5e75c72..2a5301717 100644 --- a/ui/src/app/app.constants.ts +++ b/ui/src/app/app.constants.ts @@ -49,8 +49,16 @@ export function emailValidator(control: FormControl): { [key: string]: any } | n } return null } -const environment = window.location.hostname.replace('member-portal.', '').replace('.orcid.org', '') -export const ORCID_BASE_URL = 'https://' + environment + '.orcid.org' + +let environment = '' +if (window.location.hostname == 'member-portal.qa.orcid.org') { + environment = 'qa.' +} else if (window.location.hostname == 'member-portal.sandbox.orcid.org') { + environment = 'sandbox.' +} + +export const ORCID_BASE_URL = 'https://' + environment + 'orcid.org' + export const BASE_URL = window.location.origin // eslint-disable-next-line diff --git a/ui/src/app/landing-page/landing-page.component.spec.ts b/ui/src/app/landing-page/landing-page.component.spec.ts index 11e501696..aa3fd6999 100644 --- a/ui/src/app/landing-page/landing-page.component.spec.ts +++ b/ui/src/app/landing-page/landing-page.component.spec.ts @@ -55,7 +55,7 @@ describe('LandingPageComponent', () => { component.processRequest('someState', '', '') expect(landingPageService.getOrcidConnectionRecord).toHaveBeenCalled() expect(component.oauthUrl).toBe( - 'https://localhost.orcid.org/oauth/authorize?response_type=token&redirect_uri=/landing-page&client_id=name&scope=/read-limited /activities/update /person/update openid&prompt=login&state=someState' + 'https://orcid.org/oauth/authorize?response_type=token&redirect_uri=/landing-page&client_id=name&scope=/read-limited /activities/update /person/update openid&prompt=login&state=someState' ) expect(landingPageService.getPublicKey).toHaveBeenCalledTimes(0) expect(windowLocationService.updateWindowLocation).toHaveBeenCalled() @@ -72,7 +72,7 @@ describe('LandingPageComponent', () => { component.processRequest('someState', '', '') expect(landingPageService.getOrcidConnectionRecord).toHaveBeenCalled() expect(component.oauthUrl).toBe( - 'https://localhost.orcid.org/oauth/authorize?response_type=token&redirect_uri=/landing-page&client_id=name&scope=/read-limited /activities/update /person/update openid&prompt=login&state=someState' + 'https://orcid.org/oauth/authorize?response_type=token&redirect_uri=/landing-page&client_id=name&scope=/read-limited /activities/update /person/update openid&prompt=login&state=someState' ) expect(landingPageService.getPublicKey).toHaveBeenCalledTimes(0) expect(windowLocationService.updateWindowLocation).toHaveBeenCalledTimes(0) @@ -92,7 +92,7 @@ describe('LandingPageComponent', () => { component.processRequest('someState', '', '') expect(landingPageService.getOrcidConnectionRecord).toHaveBeenCalled() expect(component.oauthUrl).toBe( - 'https://localhost.orcid.org/oauth/authorize?response_type=token&redirect_uri=/landing-page&client_id=name&scope=/read-limited /activities/update /person/update openid&prompt=login&state=someState' + 'https://orcid.org/oauth/authorize?response_type=token&redirect_uri=/landing-page&client_id=name&scope=/read-limited /activities/update /person/update openid&prompt=login&state=someState' ) expect(landingPageService.getPublicKey).toHaveBeenCalledTimes(0) expect(windowLocationService.updateWindowLocation).toHaveBeenCalledTimes(0)