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 (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;
}

View File

@@ -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 })}
</title>
</Helmet>
<RedirectLogistration
success={this.props.loginResult.success}
redirectUrl={this.props.loginResult.redirectUrl}
finishAuthUrl={thirdPartyAuthContext.finishAuthUrl}
/>
{/*<RedirectLogistration*/}
{/* success={this.props.loginResult.success}*/}
{/* redirectUrl={this.props.loginResult.redirectUrl}*/}
{/* finishAuthUrl={thirdPartyAuthContext.finishAuthUrl}*/}
{/*/>*/}
<div className="mw-xs mt-3">
<ThirdPartyAuthAlert
currentProvider={thirdPartyAuthContext.currentProvider}
@@ -292,16 +294,16 @@ class LoginPage extends React.Component {
onClick={this.handleSubmit}
onMouseDown={(e) => e.preventDefault()}
/>
<Link
id="forgot-password"
name="forgot-password"
className="btn btn-link font-weight-500 text-body"
to={updatePathWithQueryParams(RESET_PAGE)}
onClick={this.handleForgotPasswordLinkClickEvent}
>
{intl.formatMessage(messages['forgot.password'])}
</Link>
{this.renderThirdPartyAuth(providers, secondaryProviders, currentProvider, thirdPartyAuthApiStatus, intl)}
{/*<Link*/}
{/* id="forgot-password"*/}
{/* name="forgot-password"*/}
{/* className="btn btn-link font-weight-500 text-body"*/}
{/* to={updatePathWithQueryParams(RESET_PAGE)}*/}
{/* onClick={this.handleForgotPasswordLinkClickEvent}*/}
{/*>*/}
{/* {intl.formatMessage(messages['forgot.password'])}*/}
{/*</Link>*/}
{/*{this.renderThirdPartyAuth(providers, secondaryProviders, currentProvider, thirdPartyAuthApiStatus, intl)}*/}
</Form>
</div>
</>

View File

@@ -81,56 +81,56 @@ const Logistration = (props) => {
};
return (
<BaseComponent>
<div>
{disablePublicAccountCreation
? (
<>
<Redirect to={updatePathWithQueryParams(LOGIN_PAGE)} />
{institutionLogin && (
<Tabs defaultActiveKey="" id="controlled-tab" onSelect={handleInstitutionLogin}>
<Tab title={tabTitle} eventKey={LOGIN_PAGE} />
</Tabs>
// <BaseComponent>
<div className="d-flex justify-content-center">
{disablePublicAccountCreation
? (
<>
<Redirect to={updatePathWithQueryParams(LOGIN_PAGE)} />
{institutionLogin && (
<Tabs defaultActiveKey="" id="controlled-tab" onSelect={handleInstitutionLogin}>
<Tab title={tabTitle} eventKey={LOGIN_PAGE} />
</Tabs>
)}
<div id="main-content" className="main-content">
{!institutionLogin && (
<h3 className="mb-4.5">{formatMessage(messages['logistration.sign.in'])}</h3>
)}
<div id="main-content" className="main-content">
{!institutionLogin && (
<h3 className="mb-4.5">{formatMessage(messages['logistration.sign.in'])}</h3>
)}
<LoginPage institutionLogin={institutionLogin} handleInstitutionLogin={handleInstitutionLogin} />
</div>
</>
)
: (
<div>
{institutionLogin
? (
<Tabs defaultActiveKey="" id="controlled-tab" onSelect={handleInstitutionLogin}>
<Tab title={tabTitle} eventKey={selectedPage === LOGIN_PAGE ? LOGIN_PAGE : REGISTER_PAGE} />
</Tabs>
)
: (!isValidTpaHint() && (
<Tabs defaultActiveKey={selectedPage} id="controlled-tab" onSelect={handleOnSelect}>
<Tab title={formatMessage(messages['logistration.register'])} eventKey={REGISTER_PAGE} />
<Tab title={formatMessage(messages['logistration.sign.in'])} eventKey={LOGIN_PAGE} />
</Tabs>
))}
{ key && (
<Redirect to={updatePathWithQueryParams(key)} />
)}
<div id="main-content" className="main-content">
{selectedPage === LOGIN_PAGE
? <LoginPage institutionLogin={institutionLogin} handleInstitutionLogin={handleInstitutionLogin} />
: (
<RegistrationPage
institutionLogin={institutionLogin}
handleInstitutionLogin={handleInstitutionLogin}
/>
)}
</div>
<LoginPage institutionLogin={institutionLogin} handleInstitutionLogin={handleInstitutionLogin} />
</div>
)}
</div>
</BaseComponent>
</>
)
: (
<div>
{institutionLogin
? (
<Tabs defaultActiveKey="" id="controlled-tab" onSelect={handleInstitutionLogin}>
<Tab title={tabTitle} eventKey={selectedPage === LOGIN_PAGE ? LOGIN_PAGE : REGISTER_PAGE} />
</Tabs>
)
: (!isValidTpaHint() && (
<Tabs defaultActiveKey={selectedPage} id="controlled-tab" onSelect={handleOnSelect}>
<Tab title={formatMessage(messages['logistration.register'])} eventKey={REGISTER_PAGE} />
<Tab title={formatMessage(messages['logistration.sign.in'])} eventKey={LOGIN_PAGE} />
</Tabs>
))}
{ key && (
<Redirect to={updatePathWithQueryParams(key)} />
)}
<div id="main-content" className="main-content">
{selectedPage === LOGIN_PAGE
? <LoginPage institutionLogin={institutionLogin} handleInstitutionLogin={handleInstitutionLogin} />
: (
<RegistrationPage
institutionLogin={institutionLogin}
handleInstitutionLogin={handleInstitutionLogin}
/>
)}
</div>
</div>
)}
</div>
// </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 (
<>
<Helmet>
<title>{formatMessage(messages['register.page.title'], { siteName: getConfig().SITE_NAME })}</title>
</Helmet>
<RedirectLogistration
success={registrationResult.success}
redirectUrl={registrationResult.redirectUrl}
finishAuthUrl={finishAuthUrl}
optionalFields={optionalFields}
redirectToProgressiveProfilingPage={
getConfig().ENABLE_PROGRESSIVE_PROFILING_ON_AUTHN && Object.keys(optionalFields).includes('fields')
}
/>
{/*<RedirectLogistration*/}
{/* success={registrationResult.success}*/}
{/* redirectUrl={registrationResult.redirectUrl}*/}
{/* finishAuthUrl={finishAuthUrl}*/}
{/* optionalFields={optionalFields}*/}
{/* redirectToProgressiveProfilingPage={*/}
{/* getConfig().ENABLE_PROGRESSIVE_PROFILING_ON_AUTHN && Object.keys(optionalFields).includes('fields')*/}
{/* }*/}
{/*/>*/}
{autoSubmitRegisterForm && !errorCode.type ? (
<div className="mw-xs mt-5 text-center">
<Spinner animation="border" variant="primary" id="tpa-spinner" />
@@ -613,13 +617,13 @@ const RegistrationPage = (props) => {
onClick={handleSubmit}
onMouseDown={(e) => e.preventDefault()}
/>
<ThirdPartyAuth
currentProvider={currentProvider}
providers={providers}
secondaryProviders={secondaryProviders}
handleInstitutionLogin={handleInstitutionLogin}
thirdPartyAuthApiStatus={thirdPartyAuthApiStatus}
/>
{/*<ThirdPartyAuth*/}
{/* currentProvider={currentProvider}*/}
{/* providers={providers}*/}
{/* secondaryProviders={secondaryProviders}*/}
{/* handleInstitutionLogin={handleInstitutionLogin}*/}
{/* thirdPartyAuthApiStatus={thirdPartyAuthApiStatus}*/}
{/*/>*/}
</Form>
</div>
)}