Skip to content

Commit 90ccc01

Browse files
committed
9694-capture-affiliations-during-sign-in
1 parent b0c1358 commit 90ccc01

3 files changed

Lines changed: 19 additions & 7 deletions

File tree

src/app/authorize/pages/authorize/authorize.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ export class AuthorizeComponent {
5555

5656
// User session properties
5757
isNotImpersonating = false
58-
insidePopUpWindows = false
5958
interstitialComponent: ComponentType<any>
6059
redirectByReportAlreadyAuthorize: boolean
6160

@@ -74,7 +73,7 @@ export class AuthorizeComponent {
7473
*/
7574
ngOnInit(): void {
7675
this.loading = true
77-
this.insidePopUpWindows = !!this.window.opener
76+
7877

7978
forkJoin({
8079
platform: this.loadPlatformInfo(),

src/app/core/login-interstitials-manager/implementations/login-affiliation-interstitials-manager.service.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, Injectable, Type } from '@angular/core'
1+
import { Component, Inject, Injectable, Type } from '@angular/core'
22
import { MatLegacyDialog as MatDialog } from '@angular/material/legacy-dialog'
33
import { Observable, of } from 'rxjs'
44

@@ -17,6 +17,7 @@ import {
1717
AffilationsComponentDialogOutput,
1818
AffiliationsInterstitialDialogComponent,
1919
} from 'src/app/cdk/interstitials/affiliations-interstitial/interstitial-dialog-extend/affiliations-interstitial-dialog.component'
20+
import { WINDOW } from 'src/app/cdk/window'
2021

2122
@Injectable({
2223
providedIn: 'root',
@@ -38,7 +39,8 @@ export class LoginAffiliationInterstitialManagerService extends LoginBaseInterst
3839
matDialog: MatDialog,
3940
interstitialsService: InterstitialsService,
4041
togglzService: TogglzService,
41-
qaFlagService: QaFlagsService
42+
qaFlagService: QaFlagsService,
43+
@Inject(WINDOW) private _window: Window
4244
) {
4345
// Pass dependencies to the parent
4446
super(matDialog, togglzService, interstitialsService, qaFlagService)
@@ -58,13 +60,16 @@ export class LoginAffiliationInterstitialManagerService extends LoginBaseInterst
5860
userRecord?.userInfo?.EFFECTIVE_USER_ORCID
5961
)
6062

63+
const insideAnIframe = !!this._window.opener
64+
6165
const userHasEmploymentAffiliation = userRecord?.affiliations?.some(
6266
(affiliation) =>
6367
affiliation.type === 'EMPLOYMENT' &&
6468
affiliation.affiliationGroup.length > 0
6569
)
6670

67-
if (userHasEmploymentAffiliation || isImpersonation) return of(false)
71+
if (userHasEmploymentAffiliation || isImpersonation || insideAnIframe)
72+
return of(false)
6873
return of(true)
6974
}
7075

src/app/core/login-interstitials-manager/implementations/login-domain-interstitials-manager.service.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
ShareEmailsDomainsComponentDialogOutput,
1818
ShareEmailsDomainsDialogComponent,
1919
} from 'src/app/cdk/interstitials/share-emails-domains/interstitial-dialog-extend/share-emails-domains-dialog.component'
20+
import { WINDOW } from 'src/app/cdk/window'
2021

2122
@Injectable({
2223
providedIn: 'root',
@@ -38,7 +39,8 @@ export class LoginDomainInterstitialManagerService extends LoginBaseInterstitial
3839
_matDialog: MatDialog,
3940
interstitialsService: InterstitialsService,
4041
togglzService: TogglzService,
41-
qaFlagService: QaFlagsService
42+
qaFlagService: QaFlagsService,
43+
@Inject(WINDOW) private _window: Window,
4244
) {
4345
// Pass dependencies to the parent
4446
super(_matDialog, togglzService, interstitialsService, qaFlagService)
@@ -56,10 +58,12 @@ export class LoginDomainInterstitialManagerService extends LoginBaseInterstitial
5658
userRecord?.userInfo?.EFFECTIVE_USER_ORCID
5759
)
5860

61+
const insidePopUpWindows = !!this._window.opener
62+
5963
const hasNoPublicDomains = !this.userHasPublicDomains(userRecord.emails)
6064
const hasPrivateDomains = this.userHasPrivateDomains(userRecord.emails)
6165

62-
if (!hasNoPublicDomains || !hasPrivateDomains || isImpersonation) {
66+
if (!hasNoPublicDomains || !hasPrivateDomains || isImpersonation || insidePopUpWindows) {
6367
return of(false)
6468
}
6569
return of(true)
@@ -92,3 +96,7 @@ export class LoginDomainInterstitialManagerService extends LoginBaseInterstitial
9296
return ShareEmailsDomainsComponent
9397
}
9498
}
99+
function Inject(WINDOW: any): (target: typeof LoginDomainInterstitialManagerService, propertyKey: undefined, parameterIndex: 4) => void {
100+
throw new Error('Function not implemented.')
101+
}
102+

0 commit comments

Comments
 (0)