add enterprise login link
This commit is contained in:
@@ -5,13 +5,15 @@ export const RESET_PAGE = '/reset';
|
||||
export const DEFAULT_REDIRECT_URL = '/dashboard';
|
||||
export const PASSWORD_RESET_CONFIRM = '/password_reset_confirm/:token/';
|
||||
export const PAGE_NOT_FOUND = '/notfound';
|
||||
export const ENTERPRISE_LOGIN_URL = '/enterprise/login';
|
||||
|
||||
// Constants
|
||||
export const SUPPORTED_ICON_CLASSES = ['apple', 'facebook', 'google', 'microsoft'];
|
||||
|
||||
// Stateful Submit Button States
|
||||
export const DEFAULT_STATE = 'default';
|
||||
export const PENDING_STATE = 'pending';
|
||||
|
||||
// Constants
|
||||
export const SUPPORTED_ICON_CLASSES = ['apple', 'facebook', 'google', 'microsoft'];
|
||||
export const REGISTRATION_VALIDITY_MAP = {};
|
||||
export const REGISTRATION_OPTIONAL_MAP = {};
|
||||
export const REGISTRATION_EXTRA_FIELDS = [
|
||||
|
||||
@@ -77,7 +77,7 @@ describe('ForgotPasswordPage', () => {
|
||||
|
||||
it('should display need other help signing in button', () => {
|
||||
const wrapper = mount(reduxWrapper(<IntlForgotPasswordPage {...props} />));
|
||||
expect(wrapper.find('button.field-link').text()).toEqual('Need other help signing in?');
|
||||
expect(wrapper.find('button.field-link').first().text()).toEqual('Need other help signing in?');
|
||||
});
|
||||
|
||||
it('should display email validation error message', async () => {
|
||||
|
||||
@@ -5,7 +5,11 @@ import { faCaretDown, faCaretRight } from '@fortawesome/free-solid-svg-icons';
|
||||
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
||||
|
||||
import SwitchContent from './SwitchContent';
|
||||
import { LOGIN_PAGE, REGISTER_PAGE, RESET_PAGE } from '../data/constants';
|
||||
import {
|
||||
LOGIN_PAGE,
|
||||
REGISTER_PAGE,
|
||||
RESET_PAGE,
|
||||
} from '../data/constants';
|
||||
import messages from './messages';
|
||||
|
||||
const LoginHelpLinks = (props) => {
|
||||
|
||||
@@ -5,6 +5,7 @@ import { Input, StatefulButton, ValidationFormGroup } from '@edx/paragon';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { getConfig } from '@edx/frontend-platform';
|
||||
import ConfirmationAlert from './ConfirmationAlert';
|
||||
import { getThirdPartyAuthContext, loginRequest } from './data/actions';
|
||||
import { loginErrorSelector, loginRequestSelector, thirdPartyAuthContextSelector } from './data/selectors';
|
||||
@@ -17,7 +18,7 @@ import SocialAuthProviders from './SocialAuthProviders';
|
||||
import ThirdPartyAuthAlert from './ThirdPartyAuthAlert';
|
||||
|
||||
import {
|
||||
DEFAULT_REDIRECT_URL, DEFAULT_STATE, LOGIN_PAGE, REGISTER_PAGE,
|
||||
DEFAULT_REDIRECT_URL, DEFAULT_STATE, LOGIN_PAGE, REGISTER_PAGE, ENTERPRISE_LOGIN_URL,
|
||||
} from '../data/constants';
|
||||
import { forgotPasswordResultSelector } from '../forgot-password';
|
||||
|
||||
@@ -47,6 +48,10 @@ class LoginPage extends React.Component {
|
||||
this.props.getThirdPartyAuthContext(payload);
|
||||
}
|
||||
|
||||
getEnterPriseLoginURL() {
|
||||
return getConfig().LMS_BASE_URL + ENTERPRISE_LOGIN_URL;
|
||||
}
|
||||
|
||||
handleInstitutionLogin = () => {
|
||||
this.setState(prevState => ({ institutionLogin: !prevState.institutionLogin }));
|
||||
}
|
||||
@@ -211,6 +216,9 @@ class LoginPage extends React.Component {
|
||||
</ValidationFormGroup>
|
||||
</div>
|
||||
<LoginHelpLinks page={LOGIN_PAGE} />
|
||||
<a className="field-link mt-0" href={this.getEnterPriseLoginURL()}>
|
||||
{intl.formatMessage(messages['logistration.enterprise.login.help.message'])}
|
||||
</a>
|
||||
</div>
|
||||
<StatefulButton
|
||||
type="submit"
|
||||
|
||||
@@ -191,6 +191,11 @@ const messages = defineMessages({
|
||||
defaultMessage: '(optional)',
|
||||
description: 'Text that appears with optional field labels',
|
||||
},
|
||||
'logistration.enterprise.login.link.text': {
|
||||
id: 'logistration.enterprise.login.link.text',
|
||||
defaultMessage: 'Sign in with your company or school',
|
||||
description: 'Company or school login link text.',
|
||||
},
|
||||
});
|
||||
|
||||
export default messages;
|
||||
|
||||
@@ -23,7 +23,7 @@ describe('LoginHelpLinks', () => {
|
||||
const loginHelpLinks = mount(reduxWrapper(<LoginHelpLinks {...props} />));
|
||||
|
||||
expect(loginHelpLinks.find('.login-help').length).toBe(0);
|
||||
loginHelpLinks.find('button').simulate('click');
|
||||
loginHelpLinks.find('button').first().simulate('click');
|
||||
expect(loginHelpLinks.find('.login-help').length).toBe(1);
|
||||
});
|
||||
|
||||
@@ -34,7 +34,7 @@ describe('LoginHelpLinks', () => {
|
||||
};
|
||||
|
||||
const wrapper = mount(reduxWrapper(<LoginHelpLinks {...props} />));
|
||||
wrapper.find('button').simulate('click');
|
||||
wrapper.find('button').first().simulate('click');
|
||||
|
||||
const loginHelpLinks = wrapper.find('a');
|
||||
|
||||
@@ -49,7 +49,7 @@ describe('LoginHelpLinks', () => {
|
||||
};
|
||||
|
||||
const wrapper = mount(reduxWrapper(<LoginHelpLinks {...props} />));
|
||||
wrapper.find('button').simulate('click');
|
||||
wrapper.find('button').first().simulate('click');
|
||||
|
||||
const loginHelpLinks = wrapper.find('a');
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ describe('LoginPage', () => {
|
||||
|
||||
it('should display login help button', () => {
|
||||
const root = mount(reduxWrapper(<IntlLoginPage {...props} />));
|
||||
expect(root.find('button.field-link').text()).toEqual('Need help signing in?');
|
||||
expect(root.find('button.field-link').first().text()).toEqual('Need help signing in?');
|
||||
});
|
||||
|
||||
it('updates the error state for invalid email', () => {
|
||||
|
||||
@@ -151,6 +151,12 @@ exports[`LoginPage should match TPA provider snapshot 1`] = `
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<a
|
||||
className="field-link mt-0"
|
||||
href="http://localhost:18000/enterprise/login"
|
||||
>
|
||||
!!! Missing message supplied to intl.formatMessage !!!
|
||||
</a>
|
||||
</div>
|
||||
<button
|
||||
aria-disabled={false}
|
||||
@@ -356,6 +362,12 @@ exports[`LoginPage should match default section snapshot 1`] = `
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<a
|
||||
className="field-link mt-0"
|
||||
href="http://localhost:18000/enterprise/login"
|
||||
>
|
||||
!!! Missing message supplied to intl.formatMessage !!!
|
||||
</a>
|
||||
</div>
|
||||
<button
|
||||
aria-disabled={false}
|
||||
@@ -527,6 +539,12 @@ exports[`LoginPage should match forget password alert message snapshot 1`] = `
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<a
|
||||
className="field-link mt-0"
|
||||
href="http://localhost:18000/enterprise/login"
|
||||
>
|
||||
!!! Missing message supplied to intl.formatMessage !!!
|
||||
</a>
|
||||
</div>
|
||||
<button
|
||||
aria-disabled={false}
|
||||
@@ -698,6 +716,12 @@ exports[`LoginPage should match pending button state snapshot 1`] = `
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<a
|
||||
className="field-link mt-0"
|
||||
href="http://localhost:18000/enterprise/login"
|
||||
>
|
||||
!!! Missing message supplied to intl.formatMessage !!!
|
||||
</a>
|
||||
</div>
|
||||
<button
|
||||
aria-disabled={true}
|
||||
@@ -895,6 +919,12 @@ exports[`LoginPage should show error message 1`] = `
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<a
|
||||
className="field-link mt-0"
|
||||
href="http://localhost:18000/enterprise/login"
|
||||
>
|
||||
!!! Missing message supplied to intl.formatMessage !!!
|
||||
</a>
|
||||
</div>
|
||||
<button
|
||||
aria-disabled={false}
|
||||
|
||||
Reference in New Issue
Block a user