From db75d5046d3ff7b180ac31731d3b5e13eafaa506 Mon Sep 17 00:00:00 2001 From: Syed Sajjad Hussain Shah Date: Tue, 6 Jun 2023 16:51:11 +0500 Subject: [PATCH] test: temp changes for embedded authn poc --- src/common-components/UnAuthOnlyRoute.jsx | 3 + src/login/LoginPage.jsx | 32 ++++---- src/logistration/Logistration.jsx | 96 +++++++++++------------ src/register/RegistrationPage.jsx | 36 +++++---- 4 files changed, 88 insertions(+), 79 deletions(-) diff --git a/src/common-components/UnAuthOnlyRoute.jsx b/src/common-components/UnAuthOnlyRoute.jsx index 52d532da..0a6eca48 100644 --- a/src/common-components/UnAuthOnlyRoute.jsx +++ b/src/common-components/UnAuthOnlyRoute.jsx @@ -23,6 +23,9 @@ const UnAuthOnlyRoute = (props) => { if (isReady) { if (authUser && authUser.username) { + if (true) { // check for query param + window.parent.postMessage({ authenticated: true }, 'https://discover.edx.org/social-reg'); + } global.location.href = getConfig().LMS_BASE_URL.concat(DEFAULT_REDIRECT_URL); return null; } diff --git a/src/login/LoginPage.jsx b/src/login/LoginPage.jsx index 1fc44d76..d02cf7d6 100644 --- a/src/login/LoginPage.jsx +++ b/src/login/LoginPage.jsx @@ -231,7 +231,9 @@ class LoginPage extends React.Component { tpaAuthenticationError.errorCode = TPA_AUTHENTICATION_FAILURE; } if (this.props.loginResult.success) { + window.parent.postMessage({ loggedin: true, redirectUrl: this.props.loginResult.redirectUrl }, 'https://discover.edx.org/social-reg'); setSurveyCookie('login'); + return null; } return ( @@ -241,11 +243,11 @@ class LoginPage extends React.Component { { siteName: getConfig().SITE_NAME })} - + {/**/}
e.preventDefault()} /> - - {intl.formatMessage(messages['forgot.password'])} - - {this.renderThirdPartyAuth(providers, secondaryProviders, currentProvider, thirdPartyAuthApiStatus, intl)} + {/**/} + {/* {intl.formatMessage(messages['forgot.password'])}*/} + {/**/} + {/*{this.renderThirdPartyAuth(providers, secondaryProviders, currentProvider, thirdPartyAuthApiStatus, intl)}*/}
diff --git a/src/logistration/Logistration.jsx b/src/logistration/Logistration.jsx index b7498115..216345d8 100644 --- a/src/logistration/Logistration.jsx +++ b/src/logistration/Logistration.jsx @@ -81,56 +81,56 @@ const Logistration = (props) => { }; return ( - -
- {disablePublicAccountCreation - ? ( - <> - - {institutionLogin && ( - - - + // +
+ {disablePublicAccountCreation + ? ( + <> + + {institutionLogin && ( + + + + )} +
+ {!institutionLogin && ( +

{formatMessage(messages['logistration.sign.in'])}

)} -
- {!institutionLogin && ( -

{formatMessage(messages['logistration.sign.in'])}

- )} - -
- - ) - : ( -
- {institutionLogin - ? ( - - - - ) - : (!isValidTpaHint() && ( - - - - - ))} - { key && ( - - )} -
- {selectedPage === LOGIN_PAGE - ? - : ( - - )} -
+
- )} -
- + + ) + : ( +
+ {institutionLogin + ? ( + + + + ) + : (!isValidTpaHint() && ( + + + + + ))} + { key && ( + + )} +
+ {selectedPage === LOGIN_PAGE + ? + : ( + + )} +
+
+ )} +
+ //
); }; diff --git a/src/register/RegistrationPage.jsx b/src/register/RegistrationPage.jsx index e2316373..ffb4a91e 100644 --- a/src/register/RegistrationPage.jsx +++ b/src/register/RegistrationPage.jsx @@ -510,20 +510,24 @@ const RegistrationPage = (props) => { /> ); } + if (registrationResult.success) { + window.parent.postMessage({ loggedin: true, redirectUrl: registrationResult.redirectUrl }, 'https://discover.edx.org/social-reg'); + return null; + } return ( <> {formatMessage(messages['register.page.title'], { siteName: getConfig().SITE_NAME })} - + {/**/} {autoSubmitRegisterForm && !errorCode.type ? (
@@ -613,13 +617,13 @@ const RegistrationPage = (props) => { onClick={handleSubmit} onMouseDown={(e) => e.preventDefault()} /> - + {/**/}
)}