Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/logistration/Logistration.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { connect } from 'react-redux';

// Todo: need to change imports when package is published to edly-io
import { emailCheckComplete, EmailCheckWidget } from '@anas_hameed/edly-saas-widget';

Check failure on line 5 in src/logistration/Logistration.jsx

View workflow job for this annotation

GitHub Actions / tests

Unable to resolve path to module '@anas_hameed/edly-saas-widget'
import { getConfig } from '@edx/frontend-platform';
import { sendPageEvent, sendTrackEvent } from '@edx/frontend-platform/analytics';
import { getAuthService } from '@edx/frontend-platform/auth';
Expand Down Expand Up @@ -36,7 +36,7 @@
import ResetPasswordSuccess from '../reset-password/ResetPasswordSuccess';

const Logistration = (props) => {
const { selectedPage, tpaProviders, showEmailCheck } = props;
const { selectedPage: selectedPageProp, tpaProviders, showEmailCheck } = props;
const tpaHint = getTpaHint();
const {
providers, secondaryProviders,
Expand All @@ -48,6 +48,7 @@
const navigate = useNavigate();
const disablePublicAccountCreation = getConfig().ALLOW_PUBLIC_ACCOUNT_CREATION === false;
const hideRegistrationLink = getConfig().SHOW_REGISTRATION_LINKS === false;
const selectedPage = redirectTo ? `/${redirectTo}` : selectedPageProp;

useEffect(() => {
const authService = getAuthService();
Expand All @@ -62,6 +63,10 @@
}
}, [navigate, disablePublicAccountCreation]);

useEffect(() => {
setRedirectTo(null);
}, [selectedPageProp]);

const handleInstitutionLogin = (e) => {
sendTrackEvent('edx.bi.institution_login_form.toggled', { category: 'user-engagement' });
if (typeof e === 'string') {
Expand All @@ -84,6 +89,7 @@
} else if (tabKey === REGISTER_PAGE) {
props.backupLoginForm();
}
setRedirectTo(null);
setKey(tabKey);
};

Expand All @@ -103,13 +109,9 @@
return !!provider;
};

const handleEmailCheckComplete = (redirectTo, email, errorCode) => {
const handleEmailCheckComplete = (targetRedirect, email, errorCode) => {
props.emailCheckComplete(email, errorCode);
setRedirectTo(redirectTo);
const targetPage = redirectTo === 'login' ? LOGIN_PAGE : REGISTER_PAGE;
if (selectedPage !== targetPage) {
navigate(updatePathWithQueryParams(targetPage));
}
setRedirectTo(targetRedirect);
};

const activationMsgType = getActivationStatus();
Expand Down
Loading