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
REGISTER_CONVERSION_COOKIE_NAME = null
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ const configuration = {
19
19
PRIVACY_POLICY : process . env . PRIVACY_POLICY || 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
// Miscellaneous
23
24
GENERAL_RECOMMENDATIONS : process . env . GENERAL_RECOMMENDATIONS || '[]' ,
24
25
INFO_EMAIL : process . env . INFO_EMAIL || '' ,
Original file line number Diff line number Diff line change @@ -321,6 +321,18 @@ class LoginPage extends React.Component {
321
321
} = this . props ;
322
322
const { currentProvider, providers, secondaryProviders } = this . props . thirdPartyAuthContext ;
323
323
324
+ const unlinkedProvisionUrl = getConfig ( ) . TPA_UNLINKED_ACCOUNT_PROVISION_URL ;
325
+
326
+ /**
327
+ * When currentProvider exists and we are in a login page, it is
328
+ * because the third-party authenticated account is not linked.
329
+ * See also ThirdPartyAuthAlert.jsx.
330
+ */
331
+ if ( currentProvider && unlinkedProvisionUrl ) {
332
+ window . location . href = unlinkedProvisionUrl ;
333
+ return null ;
334
+ }
335
+
324
336
if ( this . tpaHint ) {
325
337
if ( thirdPartyAuthApiStatus === PENDING_STATE ) {
326
338
return < Skeleton height = { 36 } /> ;
Original file line number Diff line number Diff line change @@ -791,4 +791,24 @@ describe('LoginPage', () => {
791
791
792
792
expect ( store . dispatch ) . toHaveBeenCalledWith ( loginRemovePasswordResetBanner ( ) ) ;
793
793
} ) ;
794
+
795
+ it ( 'should redirect to provisioning URL on unlinked third-party auth account' , ( ) => {
796
+ mergeConfig ( {
797
+ TPA_UNLINKED_ACCOUNT_PROVISION_URL : 'http://example.com' ,
798
+ } ) ;
799
+
800
+ store = mockStore ( {
801
+ ...initialState ,
802
+ commonComponents : {
803
+ ...initialState . commonComponents ,
804
+ thirdPartyAuthContext : {
805
+ ...initialState . commonComponents . thirdPartyAuthContext ,
806
+ currentProvider : ssoProvider . name ,
807
+ } ,
808
+ } ,
809
+ } ) ;
810
+
811
+ const loginPage = mount ( reduxWrapper ( < IntlLoginPage { ...props } /> ) ) ;
812
+ expect ( window . location . href ) . toEqual ( 'http://example.com' ) ;
813
+ } ) ;
794
814
} ) ;
You can’t perform that action at this time.
0 commit comments