Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add accounnt and profile urls in env files #949

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ DISCOVERY_API_BASE_URL=''
ECOMMERCE_BASE_URL=''
ENABLE_DEMOGRAPHICS_COLLECTION=''
FAVICON_URL=''
ACCOUNT_SETTINGS_URL=''
ACCOUNT_PROFILE_URL=''
LANGUAGE_PREFERENCE_COOKIE_NAME=''
LMS_BASE_URL=''
LOGIN_URL=''
Expand Down
2 changes: 2 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ DEMOGRAPHICS_BASE_URL='http://localhost:18360'
DISCOVERY_API_BASE_URL=''
ECOMMERCE_BASE_URL='http://localhost:18130'
ENABLE_DEMOGRAPHICS_COLLECTION=''
ACCOUNT_SETTINGS_URL=http://localhost:1997
ACCOUNT_PROFILE_URL=http://localhost:1995
FAVICON_URL=https://edx-cdn.org/v3/default/favicon.ico
LANGUAGE_PREFERENCE_COOKIE_NAME='openedx-language-preference'
LMS_BASE_URL='http://localhost:18000'
Expand Down
2 changes: 2 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ CREDENTIALS_BASE_URL='http://localhost:18150'
CSRF_TOKEN_API_PATH='/csrf/api/v1/token'
DEMOGRAPHICS_BASE_URL='http://localhost:18360'
DISCOVERY_API_BASE_URL=''
ACCOUNT_SETTINGS_URL='http://localhost:1997'
ACCOUNT_PROFILE_URL='http://localhost:1995'
ECOMMERCE_BASE_URL='http://localhost:18130'
ENABLE_DEMOGRAPHICS_COLLECTION=''
FAVICON_URL=https://edx-cdn.org/v3/default/favicon.ico
Expand Down
2 changes: 1 addition & 1 deletion src/account-settings/name-change/NameChange.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const NameChangeModal = ({
useEffect(() => {
if (saveState === 'complete') {
handleClose();
navigate(`/id-verification?next=${encodeURIComponent('account/settings')}`);
navigate(`/id-verification?next=${encodeURIComponent('/')}`);
}
}, [handleClose, navigate, saveState]);

Expand Down
3 changes: 3 additions & 0 deletions src/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,20 @@ export function useAsyncCall(asyncFunc) {
export function useRedirect() {
const [redirect, setRedirect] = useState({
location: 'dashboard',
isAccountMFERedirect: false,
text: 'id.verification.return.dashboard',
});

useEffect(() => {
if (sessionStorage.getItem('courseId')) {
setRedirect({
isAccountMFERedirect: false,
location: `courses/${sessionStorage.getItem('courseId')}`,
text: 'id.verification.return.course',
});
} else if (sessionStorage.getItem('next')) {
setRedirect({
isAccountMFERedirect: true,
location: sessionStorage.getItem('next'),
text: 'id.verification.return.generic',
});
Expand Down
5 changes: 3 additions & 2 deletions src/id-verification/panels/SubmittedPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ import BasePanel from './BasePanel';

const SubmittedPanel = (props) => {
const { userId } = useContext(IdVerificationContext);
const { location: returnUrl, text: returnText } = useRedirect();
const { location: returnUrl, text: returnText, isAccountMFERedirect } = useRedirect();
const panelSlug = 'submitted';
const URL = isAccountMFERedirect ? returnUrl : `${getConfig().LMS_BASE_URL}/${returnUrl}`;

useEffect(() => {
sendTrackEvent('edx.id_verification.submitted', {
Expand All @@ -32,7 +33,7 @@ const SubmittedPanel = (props) => {
</p>
<a
className="btn btn-primary"
href={`${getConfig().LMS_BASE_URL}/${returnUrl}`}
href={URL}
data-testid="return-button"
>
{props.intl.formatMessage(messages[returnText])}
Expand Down
2 changes: 1 addition & 1 deletion src/id-verification/tests/panels/SubmittedPanel.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ describe('SubmittedPanel', () => {
)));
const button = await screen.findByTestId('return-button');
expect(button).toHaveTextContent(/Return/);
expect(button).toHaveAttribute('href', `${process.env.LMS_BASE_URL}/some_page`);
expect(button).toHaveAttribute('href', 'some_page');
});
});
Loading