Skip to content

Commit

Permalink
Merge pull request #1238 from ORCID/orcid-base-url-fix
Browse files Browse the repository at this point in the history
fix orcid base url fix
  • Loading branch information
bobcaprice authored Aug 6, 2024
2 parents 11654a4 + 9a8f6e6 commit bf57e84
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
12 changes: 10 additions & 2 deletions ui/src/app/app.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions ui/src/app/landing-page/landing-page.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit bf57e84

Please sign in to comment.