Compare commits

...

1 Commits

Author SHA1 Message Date
Syed Sajjad Hussain Shah
db75d5046d test: temp changes for embedded authn poc 2023-06-06 18:50:45 +05:00
4 changed files with 88 additions and 79 deletions

View File

@@ -23,6 +23,9 @@ const UnAuthOnlyRoute = (props) => {
if (isReady) { if (isReady) {
if (authUser && authUser.username) { 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); global.location.href = getConfig().LMS_BASE_URL.concat(DEFAULT_REDIRECT_URL);
return null; return null;
} }

View File

@@ -231,7 +231,9 @@ class LoginPage extends React.Component {
tpaAuthenticationError.errorCode = TPA_AUTHENTICATION_FAILURE; tpaAuthenticationError.errorCode = TPA_AUTHENTICATION_FAILURE;
} }
if (this.props.loginResult.success) { if (this.props.loginResult.success) {
window.parent.postMessage({ loggedin: true, redirectUrl: this.props.loginResult.redirectUrl }, 'https://discover.edx.org/social-reg');
setSurveyCookie('login'); setSurveyCookie('login');
return null;
} }
return ( return (
@@ -241,11 +243,11 @@ class LoginPage extends React.Component {
{ siteName: getConfig().SITE_NAME })} { siteName: getConfig().SITE_NAME })}
</title> </title>
</Helmet> </Helmet>
<RedirectLogistration {/*<RedirectLogistration*/}
success={this.props.loginResult.success} {/* success={this.props.loginResult.success}*/}
redirectUrl={this.props.loginResult.redirectUrl} {/* redirectUrl={this.props.loginResult.redirectUrl}*/}
finishAuthUrl={thirdPartyAuthContext.finishAuthUrl} {/* finishAuthUrl={thirdPartyAuthContext.finishAuthUrl}*/}
/> {/*/>*/}
<div className="mw-xs mt-3"> <div className="mw-xs mt-3">
<ThirdPartyAuthAlert <ThirdPartyAuthAlert
currentProvider={thirdPartyAuthContext.currentProvider} currentProvider={thirdPartyAuthContext.currentProvider}
@@ -292,16 +294,16 @@ class LoginPage extends React.Component {
onClick={this.handleSubmit} onClick={this.handleSubmit}
onMouseDown={(e) => e.preventDefault()} onMouseDown={(e) => e.preventDefault()}
/> />
<Link {/*<Link*/}
id="forgot-password" {/* id="forgot-password"*/}
name="forgot-password" {/* name="forgot-password"*/}
className="btn btn-link font-weight-500 text-body" {/* className="btn btn-link font-weight-500 text-body"*/}
to={updatePathWithQueryParams(RESET_PAGE)} {/* to={updatePathWithQueryParams(RESET_PAGE)}*/}
onClick={this.handleForgotPasswordLinkClickEvent} {/* onClick={this.handleForgotPasswordLinkClickEvent}*/}
> {/*>*/}
{intl.formatMessage(messages['forgot.password'])} {/* {intl.formatMessage(messages['forgot.password'])}*/}
</Link> {/*</Link>*/}
{this.renderThirdPartyAuth(providers, secondaryProviders, currentProvider, thirdPartyAuthApiStatus, intl)} {/*{this.renderThirdPartyAuth(providers, secondaryProviders, currentProvider, thirdPartyAuthApiStatus, intl)}*/}
</Form> </Form>
</div> </div>
</> </>

View File

@@ -81,8 +81,8 @@ const Logistration = (props) => {
}; };
return ( return (
<BaseComponent> // <BaseComponent>
<div> <div className="d-flex justify-content-center">
{disablePublicAccountCreation {disablePublicAccountCreation
? ( ? (
<> <>
@@ -130,7 +130,7 @@ const Logistration = (props) => {
</div> </div>
)} )}
</div> </div>
</BaseComponent> // </BaseComponent>
); );
}; };

View File

@@ -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 ( return (
<> <>
<Helmet> <Helmet>
<title>{formatMessage(messages['register.page.title'], { siteName: getConfig().SITE_NAME })}</title> <title>{formatMessage(messages['register.page.title'], { siteName: getConfig().SITE_NAME })}</title>
</Helmet> </Helmet>
<RedirectLogistration {/*<RedirectLogistration*/}
success={registrationResult.success} {/* success={registrationResult.success}*/}
redirectUrl={registrationResult.redirectUrl} {/* redirectUrl={registrationResult.redirectUrl}*/}
finishAuthUrl={finishAuthUrl} {/* finishAuthUrl={finishAuthUrl}*/}
optionalFields={optionalFields} {/* optionalFields={optionalFields}*/}
redirectToProgressiveProfilingPage={ {/* redirectToProgressiveProfilingPage={*/}
getConfig().ENABLE_PROGRESSIVE_PROFILING_ON_AUTHN && Object.keys(optionalFields).includes('fields') {/* getConfig().ENABLE_PROGRESSIVE_PROFILING_ON_AUTHN && Object.keys(optionalFields).includes('fields')*/}
} {/* }*/}
/> {/*/>*/}
{autoSubmitRegisterForm && !errorCode.type ? ( {autoSubmitRegisterForm && !errorCode.type ? (
<div className="mw-xs mt-5 text-center"> <div className="mw-xs mt-5 text-center">
<Spinner animation="border" variant="primary" id="tpa-spinner" /> <Spinner animation="border" variant="primary" id="tpa-spinner" />
@@ -613,13 +617,13 @@ const RegistrationPage = (props) => {
onClick={handleSubmit} onClick={handleSubmit}
onMouseDown={(e) => e.preventDefault()} onMouseDown={(e) => e.preventDefault()}
/> />
<ThirdPartyAuth {/*<ThirdPartyAuth*/}
currentProvider={currentProvider} {/* currentProvider={currentProvider}*/}
providers={providers} {/* providers={providers}*/}
secondaryProviders={secondaryProviders} {/* secondaryProviders={secondaryProviders}*/}
handleInstitutionLogin={handleInstitutionLogin} {/* handleInstitutionLogin={handleInstitutionLogin}*/}
thirdPartyAuthApiStatus={thirdPartyAuthApiStatus} {/* thirdPartyAuthApiStatus={thirdPartyAuthApiStatus}*/}
/> {/*/>*/}
</Form> </Form>
</div> </div>
)} )}