-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Merge pull request #2387 from ORCID/lmendoza/9422-email-domains-inter…
…stitial-oauth Lmendoza/9422 email domains interstitial oauth
Showing
5 changed files
with
80 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { TestBed } from '@angular/core/testing' | ||
|
||
import { InterstitialsService } from './interstitials.service' | ||
import { UserService } from 'src/app/core' | ||
|
||
describe('InterstitialsService', () => { | ||
let service: InterstitialsService | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
providers: [ | ||
{ | ||
provide: UserService, | ||
useValue: {}, | ||
}, | ||
], | ||
}) | ||
service = TestBed.inject(InterstitialsService) | ||
}) | ||
|
||
it('should be created', () => { | ||
expect(service).toBeTruthy() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Injectable } from '@angular/core' | ||
import { userInfo } from 'os' | ||
import { map } from 'rxjs/operators' | ||
import { UserService } from 'src/app/core' | ||
type Interstitials = 'OAUTH_DOMAIN_INTERSTITIAL' | 'SIGN_IN_DOMAIN_INTERSTITIAL' | ||
|
||
@Injectable({ | ||
providedIn: 'root', | ||
}) | ||
export class InterstitialsService { | ||
constructor(private _userInfo: UserService) {} | ||
|
||
setInterstitialsViewed(interstitial: Interstitials) { | ||
return this._userInfo.getUserSession().pipe( | ||
map((userInfo) => { | ||
const effectiveUser = userInfo.userInfo.EFFECTIVE_USER_ORCID | ||
localStorage.setItem(effectiveUser + '_' + interstitial, 'true') | ||
}) | ||
) | ||
} | ||
getInterstitialsViewed(interstitial: Interstitials) { | ||
return this._userInfo.getUserSession().pipe( | ||
map((userInfo) => { | ||
const effectiveUser = userInfo.userInfo.EFFECTIVE_USER_ORCID | ||
return ( | ||
localStorage.getItem(effectiveUser + '_' + interstitial) === 'true' | ||
) | ||
}) | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters