Add remote var for login issue support url

This commit is contained in:
uzairr
2021-01-01 16:18:34 +05:00
parent 43e811e1f6
commit db95674bec
6 changed files with 28 additions and 6 deletions

1
.env
View File

@@ -15,3 +15,4 @@ SEGMENT_KEY=null
SITE_NAME=null
USER_INFO_COOKIE_NAME=null
LOGISTRATION_MINIMAL_HEADER=true
LOGIN_ISSUE_SUPPORT_LINK=null

View File

@@ -20,3 +20,4 @@ SEGMENT_KEY=null
SITE_NAME='edX'
USER_INFO_COOKIE_NAME='edx-user-info'
LOGISTRATION_MINIMAL_HEADER=true
LOGIN_ISSUE_SUPPORT_LINK=''

View File

@@ -17,3 +17,4 @@ REFRESH_ACCESS_TOKEN_ENDPOINT='http://localhost:18000/login_refresh'
SEGMENT_KEY=null
SITE_NAME='edX'
USER_INFO_COOKIE_NAME='edx-user-info'
LOGIN_ISSUE_SUPPORT_LINK='https://login-issue-support-url.com'

View File

@@ -1,7 +1,7 @@
import 'babel-polyfill';
import {
APP_INIT_ERROR, APP_READY, subscribe, initialize,
APP_INIT_ERROR, APP_READY, subscribe, initialize, mergeConfig,
} from '@edx/frontend-platform';
import { AppProvider, ErrorPage } from '@edx/frontend-platform/react';
import React from 'react';
@@ -52,6 +52,13 @@ subscribe(APP_INIT_ERROR, (error) => {
});
initialize({
handlers: {
config: () => {
mergeConfig({
LOGIN_ISSUE_SUPPORT_LINK: process.env.LOGIN_ISSUE_SUPPORT_LINK || null,
});
},
},
messages: [
appMessages,
headerMessages,

View File

@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faCaretDown, faCaretRight } from '@fortawesome/free-solid-svg-icons';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import { getConfig } from '@edx/frontend-platform';
import SwitchContent from './SwitchContent';
import {
@@ -33,6 +34,14 @@ const LoginHelpLinks = (props) => {
</a>
);
const loginIssueSupportURL = (config) => (config.LOGIN_ISSUE_SUPPORT_LINK
? (
<a className="field-link" href={config.LOGIN_ISSUE_SUPPORT_LINK}>
{intl.formatMessage(messages['logistration.other.sign.in.issues'])}
</a>
)
: null);
const getHelpButtonMessage = () => {
let mid = 'logistration.need.other.help.signing.in.collapsible.menu';
if (page === LOGIN_PAGE) {
@@ -44,10 +53,8 @@ const LoginHelpLinks = (props) => {
const renderLoginHelp = () => (
<div className="login-help">
{ page === LOGIN_PAGE ? forgotPasswordLink() : signUpLink()}
<a className="field-link" href="https://support.edx.org/hc/en-us/sections/115004153367-Solve-a-Sign-in-Problem">
{intl.formatMessage(messages['logistration.other.sign.in.issues'])}
</a>
{ page === LOGIN_PAGE ? forgotPasswordLink() : signUpLink() }
{ loginIssueSupportURL(getConfig()) }
</div>
);

View File

@@ -5,9 +5,14 @@ import { mount } from 'enzyme';
import LoginHelpLinks from '../LoginHelpLinks';
import { LOGIN_PAGE } from '../../data/constants';
const otherSignInIssues = 'https://login-issue-support-url.com';
jest.mock('@edx/frontend-platform', () => ({
getConfig: jest.fn().mockReturnValue({ LOGIN_ISSUE_SUPPORT_LINK: otherSignInIssues }),
}));
describe('LoginHelpLinks', () => {
let props = {};
const otherSignInIssues = 'https://support.edx.org/hc/en-us/sections/115004153367-Solve-a-Sign-in-Problem';
const reduxWrapper = children => (
<IntlProvider locale="en">