diff --git a/src/app/authorize/pages/authorize/authorize.component.ts b/src/app/authorize/pages/authorize/authorize.component.ts index 0cea0403e..45eeb7e42 100644 --- a/src/app/authorize/pages/authorize/authorize.component.ts +++ b/src/app/authorize/pages/authorize/authorize.component.ts @@ -95,11 +95,11 @@ export class AuthorizeComponent { if ( url && this.userHasPrivateDomains && - !this.userHasPublicDomains - // this.oauthDomainsInterstitialEnabled && - // !this.domainInterstitialHasBeenViewed && - // this.userIsNotImpersonating && - // !this.insidePopUpWindows + !this.userHasPublicDomains && + this.oauthDomainsInterstitialEnabled && + !this.domainInterstitialHasBeenViewed && + this.userIsNotImpersonating && + !this.insidePopUpWindows ) { this.showAuthorizationComponent = false this.showInterstital = true diff --git a/src/app/core/login-interstitials/login-interstitials.service.ts b/src/app/core/login-interstitials/login-interstitials.service.ts index e2c59e220..9a3ac6b6e 100644 --- a/src/app/core/login-interstitials/login-interstitials.service.ts +++ b/src/app/core/login-interstitials/login-interstitials.service.ts @@ -18,6 +18,7 @@ import { TogglzService } from '../togglz/togglz.service' export class LoginInterstitialsService { alreadySawSignDomainInterstitial: boolean loginDomainsInterstitialEnabled: boolean + alreadyCheckLoginInterstitials: boolean constructor( private _matDialog: MatDialog, private interstitialService: InterstitialsService, @@ -36,37 +37,40 @@ export class LoginInterstitialsService { } checkLoginInterstitials(userRecord: UserRecord): Observable | void { - let isNotImpersonating - if (userRecord.userInfo) { - isNotImpersonating = - userRecord.userInfo.REAL_USER_ORCID === - userRecord.userInfo.EFFECTIVE_USER_ORCID - } if ( - // isNotImpersonating && - userRecord.emails && - userRecord.emails.emailDomains && - !this.userHasPublicDomains(userRecord.emails) && - this.userHasPrivateDomains(userRecord.emails) && - // this.loginDomainsInterstitialEnabled && - !this.alreadySawSignDomainInterstitial + userRecord?.userInfo && + userRecord?.emails?.emailDomains && + !this.alreadyCheckLoginInterstitials ) { - this.alreadySawSignDomainInterstitial = true - this.interstitialService - .setInterstitialsViewed('SIGN_IN_DOMAIN_INTERSTITIAL') - .subscribe() - const data: ShareEmailsDomainsComponentDialogInput = { - userEmailsJson: userRecord.emails, - } + this.alreadyCheckLoginInterstitials = true + const isNotImpersonating = + userRecord.userInfo.REAL_USER_ORCID === + userRecord.userInfo.EFFECTIVE_USER_ORCID - const dialog = this._matDialog.open(ShareEmailsDomainsDialogComponent, { - data, - width: '580px', - disableClose: true, - autoFocus: false, - restoreFocus: false, - }) - return dialog.afterClosed() + if ( + // isNotImpersonating && + !this.userHasPublicDomains(userRecord.emails) && + this.userHasPrivateDomains(userRecord.emails) && + // this.loginDomainsInterstitialEnabled && + !this.alreadySawSignDomainInterstitial + ) { + this.alreadySawSignDomainInterstitial = true + this.interstitialService + .setInterstitialsViewed('SIGN_IN_DOMAIN_INTERSTITIAL') + .subscribe() + const data: ShareEmailsDomainsComponentDialogInput = { + userEmailsJson: userRecord.emails, + } + + const dialog = this._matDialog.open(ShareEmailsDomainsDialogComponent, { + data, + width: '580px', + disableClose: true, + autoFocus: false, + restoreFocus: false, + }) + return dialog.afterClosed() + } } }