File tree 4 files changed +34
-0
lines changed
4 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ ORDER_HISTORY_URL=null
13
13
REFRESH_ACCESS_TOKEN_ENDPOINT = null
14
14
SEGMENT_KEY = ' '
15
15
SITE_NAME = null
16
+ TPA_UNLINKED_ACCOUNT_PROVISION_URL = null
16
17
INFO_EMAIL = ' '
17
18
# ***** Cookies *****
18
19
USER_RETENTION_COOKIE_NAME = null
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ const configuration = {
19
19
SEARCH_CATALOG_URL : process . env . SEARCH_CATALOG_URL || null ,
20
20
TOS_AND_HONOR_CODE : process . env . TOS_AND_HONOR_CODE || null ,
21
21
TOS_LINK : process . env . TOS_LINK || null ,
22
+ TPA_UNLINKED_ACCOUNT_PROVISION_URL : process . env . TPA_UNLINKED_ACCOUNT_PROVISION_URL || null ,
22
23
// Base container images
23
24
BANNER_IMAGE_LARGE : process . env . BANNER_IMAGE_LARGE || '' ,
24
25
BANNER_IMAGE_MEDIUM : process . env . BANNER_IMAGE_MEDIUM || '' ,
Original file line number Diff line number Diff line change @@ -310,6 +310,18 @@ class LoginPage extends React.Component {
310
310
} = this . props ;
311
311
const { currentProvider, providers, secondaryProviders } = this . props . thirdPartyAuthContext ;
312
312
313
+ const unlinkedProvisionUrl = getConfig ( ) . TPA_UNLINKED_ACCOUNT_PROVISION_URL ;
314
+
315
+ /**
316
+ * When currentProvider exists and we are in a login page, it is
317
+ * because the third-party authenticated account is not linked.
318
+ * See also ThirdPartyAuthAlert.jsx.
319
+ */
320
+ if ( currentProvider && unlinkedProvisionUrl ) {
321
+ window . location . href = unlinkedProvisionUrl ;
322
+ return null ;
323
+ }
324
+
313
325
if ( this . tpaHint ) {
314
326
if ( thirdPartyAuthApiStatus === PENDING_STATE ) {
315
327
return < Skeleton height = { 36 } /> ;
Original file line number Diff line number Diff line change @@ -766,4 +766,24 @@ describe('LoginPage', () => {
766
766
767
767
expect ( store . dispatch ) . toHaveBeenCalledWith ( loginRemovePasswordResetBanner ( ) ) ;
768
768
} ) ;
769
+
770
+ it ( 'should redirect to provisioning URL on unlinked third-party auth account' , ( ) => {
771
+ mergeConfig ( {
772
+ TPA_UNLINKED_ACCOUNT_PROVISION_URL : 'http://example.com' ,
773
+ } ) ;
774
+
775
+ store = mockStore ( {
776
+ ...initialState ,
777
+ commonComponents : {
778
+ ...initialState . commonComponents ,
779
+ thirdPartyAuthContext : {
780
+ ...initialState . commonComponents . thirdPartyAuthContext ,
781
+ currentProvider : ssoProvider . name ,
782
+ } ,
783
+ } ,
784
+ } ) ;
785
+
786
+ const loginPage = mount ( reduxWrapper ( < IntlLoginPage { ...props } /> ) ) ;
787
+ expect ( window . location . href ) . toEqual ( 'http://example.com' ) ;
788
+ } ) ;
769
789
} ) ;
You can’t perform that action at this time.
0 commit comments