diff --git a/src/common-components/EnterpriseSSO.jsx b/src/common-components/EnterpriseSSO.jsx
index 72746cfc..f5cd2060 100644
--- a/src/common-components/EnterpriseSSO.jsx
+++ b/src/common-components/EnterpriseSSO.jsx
@@ -15,6 +15,7 @@ import messages from './messages';
const EnterpriseSSO = (props) => {
const { intl } = props;
const tpaProvider = props.provider;
+ const disablePublicAccountCreation = getConfig().ALLOW_PUBLIC_ACCOUNT_CREATION === false;
const handleSubmit = (e, url) => {
e.preventDefault();
@@ -61,12 +62,15 @@ const EnterpriseSSO = (props) => {
diff --git a/src/common-components/Logistration.jsx b/src/common-components/Logistration.jsx
index 93aba74a..7227baab 100644
--- a/src/common-components/Logistration.jsx
+++ b/src/common-components/Logistration.jsx
@@ -25,6 +25,7 @@ const Logistration = (props) => {
const tpa = getTpaHint();
const [institutionLogin, setInstitutionLogin] = useState(false);
const [key, setKey] = useState('');
+ const disablePublicAccountCreation = getConfig().ALLOW_PUBLIC_ACCOUNT_CREATION === false;
useEffect(() => {
const authService = getAuthService();
@@ -63,30 +64,56 @@ const Logistration = (props) => {
return (
- {institutionLogin
+ {disablePublicAccountCreation
? (
-
-
-
- )
- : (
<>
- {!tpa && (
-
-
-
+
+ {institutionLogin && (
+
+
)}
+
+ {!institutionLogin && (
+
{intl.formatMessage(messages['logistration.sign.in'])}
+ )}
+
+
>
+ )
+ : (
+
+ {institutionLogin
+ ? (
+
+
+
+ )
+ : (
+ <>
+ {!tpa && (
+
+
+
+
+ )}
+ >
+ )}
+ { key && (
+
+ )}
+
+ {selectedPage === LOGIN_PAGE
+ ?
+ : (
+
+ )}
+
+
)}
- { key && (
-
- )}
-
- {selectedPage === LOGIN_PAGE
- ?
- : }
-
);
diff --git a/src/common-components/messages.jsx b/src/common-components/messages.jsx
index 37770bbb..7136abe3 100644
--- a/src/common-components/messages.jsx
+++ b/src/common-components/messages.jsx
@@ -60,6 +60,11 @@ const messages = defineMessages({
defaultMessage: 'Show me other ways to sign in or register',
description: 'Button text for login',
},
+ 'enterprisetpa.login.button.text.public.account.creation.disabled': {
+ id: 'enterprisetpa.login.button.text.public.account.creation.disabled',
+ defaultMessage: 'Show me other ways to sign in',
+ description: 'Button text for login when account creation is disabled',
+ },
// social auth providers
'sso.sign.in.with': {
id: 'sso.sign.in.with',
diff --git a/src/common-components/tests/Logistration.test.jsx b/src/common-components/tests/Logistration.test.jsx
index 987d4b3a..7174f98b 100644
--- a/src/common-components/tests/Logistration.test.jsx
+++ b/src/common-components/tests/Logistration.test.jsx
@@ -51,6 +51,9 @@ describe('Logistration', () => {
messages: { 'es-419': {}, de: {}, 'en-us': {} },
});
+ mergeConfig({
+ ALLOW_PUBLIC_ACCOUNT_CREATION: true,
+ });
store = mockStore({
register: {
registrationResult: { success: false, redirectUrl: '' },
@@ -81,9 +84,42 @@ describe('Logistration', () => {
expect(logistration.find('#main-content').find('LoginPage').exists()).toBeTruthy();
});
+ it('should render only login page when public account creation is disabled', () => {
+ mergeConfig({
+ ALLOW_PUBLIC_ACCOUNT_CREATION: false,
+ DISABLE_ENTERPRISE_LOGIN: 'true',
+ });
+
+ store = mockStore({
+ login: {
+ loginResult: { success: false, redirectUrl: '' },
+ },
+ commonComponents: {
+ thirdPartyAuthContext: {
+ currentProvider: null,
+ finishAuthUrl: null,
+ providers: [],
+ secondaryProviders: [secondaryProviders],
+ },
+ thirdPartyAuthApiStatus: COMPLETE_STATE,
+ },
+ });
+
+ const props = { selectedPage: LOGIN_PAGE };
+ const logistration = mount(reduxWrapper());
+
+ // verifying sign in heading for institution login false
+ expect(logistration.find('#main-content').find('h3').text()).toEqual('Sign in');
+
+ // verifying tabs heading for institution login true
+ logistration.find(RenderInstitutionButton).simulate('click', { institutionLogin: true });
+ expect(logistration.find('#controlled-tab').exists()).toBeTruthy();
+ });
+
it('should display institution login option when secondary providers are present', () => {
mergeConfig({
DISABLE_ENTERPRISE_LOGIN: 'true',
+ ALLOW_PUBLIC_ACCOUNT_CREATION: 'true',
});
store = mockStore({
diff --git a/src/login/tests/LoginPage.test.jsx b/src/login/tests/LoginPage.test.jsx
index 48608368..9489e881 100644
--- a/src/login/tests/LoginPage.test.jsx
+++ b/src/login/tests/LoginPage.test.jsx
@@ -611,6 +611,51 @@ describe('LoginPage', () => {
});
});
+ it('should render other ways to sign in button', () => {
+ store = mockStore({
+ ...initialState,
+ commonComponents: {
+ ...initialState.commonComponents,
+ thirdPartyAuthContext: {
+ ...initialState.commonComponents.thirdPartyAuthContext,
+ providers: [ssoProvider],
+ },
+ thirdPartyAuthApiStatus: COMPLETE_STATE,
+ },
+ });
+
+ delete window.location;
+ window.location = { href: getConfig().BASE_URL.concat('/login'), search: `?tpa_hint=${ssoProvider.id}` };
+ ssoProvider.iconImage = null;
+
+ const loginPage = mount(reduxWrapper());
+ expect(loginPage.find('button#other-ways-to-sign-in').text()).toEqual('Show me other ways to sign in or register');
+ });
+
+ it('should render other ways to sign in button when public account creation disabled', () => {
+ mergeConfig({
+ ALLOW_PUBLIC_ACCOUNT_CREATION: false,
+ });
+ store = mockStore({
+ ...initialState,
+ commonComponents: {
+ ...initialState.commonComponents,
+ thirdPartyAuthContext: {
+ ...initialState.commonComponents.thirdPartyAuthContext,
+ providers: [ssoProvider],
+ },
+ thirdPartyAuthApiStatus: COMPLETE_STATE,
+ },
+ });
+
+ delete window.location;
+ window.location = { href: getConfig().BASE_URL.concat('/login'), search: `?tpa_hint=${ssoProvider.id}` };
+ ssoProvider.iconImage = null;
+
+ const loginPage = mount(reduxWrapper());
+ expect(loginPage.find('button#other-ways-to-sign-in').text()).toEqual('Show me other ways to sign in');
+ });
+
// ******** miscellaneous tests ********
it('should render cookie banner', () => {