Skip to content

Commit

Permalink
Merge pull request #1204 from ORCID/landingPageMissingOrcidId
Browse files Browse the repository at this point in the history
added logging
  • Loading branch information
auumgn authored Jun 3, 2024
2 parents 331c827 + 217e5b6 commit eb8384b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ui/src/app/landing-page/landing-page.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ <h2>
</h2>
<p class="mt-4">
<img class="id-icon" src="../../content/images/orcid-icon.svg" alt="orcid-logo" width="16" height="16" />
<a target="_orcidRecord" href="{{ issuer }}/my-orcid">{{ issuer }}/{{ orcidRecord.orcid }}</a>
</p>
<a target="_orcidRecord" href="{{ issuer }}/my-orcid">{{ issuer }}/{{ orcidRecord?.orcid }}</a>
</p>
<p>
{{ incorrectDataMessage }}
</p>
Expand Down
15 changes: 13 additions & 2 deletions ui/src/app/landing-page/landing-page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { MemberService } from '../member/service/member.service'
import { IMember } from '../member/model/member.model'
import { ORCID_BASE_URL } from '../app.constants'
import { WindowLocationService } from '../shared/service/window-location.service'
import { OrcidRecord } from '../shared/model/orcid-record.model'

@Component({
selector: 'app-landing-page',
Expand All @@ -27,9 +28,8 @@ export class LandingPageComponent implements OnInit {
clientName: string | undefined
salesforceId: string | undefined
clientId: string | undefined
orcidId: string | undefined
oauthUrl: string | undefined
orcidRecord: any
orcidRecord: OrcidRecord | undefined
signedInIdToken: any
givenName: string | undefined
familyName: string | undefined
Expand Down Expand Up @@ -58,11 +58,17 @@ export class LandingPageComponent implements OnInit {
}

processRequest(state_param: string, id_token_fragment: string, access_token_fragment: string) {
console.log('process request method, calling this.landingPageService.getOrcidConnectionRecord')

this.landingPageService.getOrcidConnectionRecord(state_param).subscribe({
next: (result) => {
console.log('got orcid record result: ', result)

this.orcidRecord = result
this.landingPageService.getMemberInfo(state_param).subscribe({
next: (res: IMember) => {
console.log('got member data')

this.clientName = res.clientName
this.clientId = res.clientId
this.salesforceId = res.salesforceId
Expand All @@ -82,6 +88,8 @@ export class LandingPageComponent implements OnInit {

// Check if id token exists in URL (user just granted permission)
if (id_token_fragment != null && id_token_fragment !== '') {
console.log('checking submit token')

this.checkSubmitToken(id_token_fragment, state_param, access_token_fragment)
} else {
const error = this.getFragmentParameterByName('error')
Expand Down Expand Up @@ -154,6 +162,9 @@ export class LandingPageComponent implements OnInit {
return
}
if (data.isSameUserThatAlreadyGranted) {
console.log('same user has already granted access. this.orcidRecord is ', this.orcidRecord)
console.log('this.orcidRecord.orcidId is ', this.orcidRecord?.orcid)

this.showConnectionExistsElement()
return
}
Expand Down

0 comments on commit eb8384b

Please sign in to comment.