Skip to content

Commit 7f5c100

Browse files
jajjibhai008iloveagent57
authored andcommitted
fix: Login redirect from admin registration page if no enterprise roles
1 parent 03187c9 commit 7f5c100

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/components/AdminRegisterPage/index.jsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useEffect } from 'react';
22
import { useNavigate, useParams } from 'react-router-dom';
33
import { logError } from '@edx/frontend-platform/logging';
4-
import { getAuthenticatedUser, getLogoutRedirectUrl } from '@edx/frontend-platform/auth';
4+
import { getAuthenticatedUser } from '@edx/frontend-platform/auth';
55
import { LoginRedirect, getProxyLoginUrl } from '@edx/frontend-enterprise-logistration';
66
import { isEnterpriseUser, ENTERPRISE_ADMIN } from '@edx/frontend-enterprise-utils';
77

@@ -24,10 +24,9 @@ const AdminRegisterPage = () => {
2424
// account activation page to ensure they verify their email address.
2525
navigate(`/${enterpriseSlug}/admin/register/activate`);
2626
} else {
27-
// user is authenticated but doesn't have the `enterprise_admin` JWT role; force a log out so their
28-
// JWT roles gets refreshed. on their next login, the JWT roles will be updated.
29-
const logoutRedirectUrl = getLogoutRedirectUrl(getProxyLoginUrl(enterpriseSlug));
30-
global.location.href = logoutRedirectUrl;
27+
// user is authenticated but doesn't have the `enterprise_admin` JWT role; redirect to
28+
// proxy login to refresh JWT cookie and pick up any new role assignments.
29+
global.location.href = getProxyLoginUrl(enterpriseSlug);
3130
}
3231
};
3332

0 commit comments

Comments
 (0)