Skip to content

Commit 0a9a473

Browse files
Merge branch 'develop' into bug-bash
2 parents 039cdd7 + 3c8a337 commit 0a9a473

File tree

38 files changed

+249
-61
lines changed

38 files changed

+249
-61
lines changed

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,15 @@ workflows:
230230
filters:
231231
branches:
232232
only:
233-
- hot-fix
233+
- develop-auth0-sync
234+
- develop
234235
# This is alternate dev env for parallel testing
235236
- "build-test":
236237
context : org-global
237238
filters:
238239
branches:
239240
only:
240-
- hot-fix
241+
- apollo-site
241242
# This is alternate dev env for parallel testing
242243
- "build-qa":
243244
context : org-global
@@ -261,7 +262,6 @@ workflows:
261262
branches:
262263
only:
263264
- develop
264-
- bug-bash
265265
# Production builds are exectuted
266266
# when PR is merged to the master
267267
# Don't change anything in this configuration

__tests__/client/client.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ const mockTcAccounts = {
106106
decodeToken: () => ({ exp: Date.now() }),
107107
getFreshToken: () => Promise.resolve(tokenV3),
108108
};
109-
jest.setMock('tc-accounts', mockTcAccounts);
109+
jest.setMock('@topcoder-platform/tc-auth-lib', mockTcAccounts);
110110
111111
/* Mock auth actions */
112112
/*

__tests__/shared/components/Header/__snapshots__/index.jsx.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ exports[`Default render 1`] = `
165165
auth={null}
166166
authURLs={
167167
Object {
168-
"href": "https://accounts.topcoder-dev.com/member/registration?utm_source=community-app-main",
169-
"location": "https://accounts.topcoder-dev.com/member?retUrl=%S&utm_source=community-app-main",
168+
"href": "https://accounts-auth0.topcoder-dev.com?utm_source=community-app-main",
169+
"location": "https://accounts-auth0.topcoder-dev.com?retUrl=%S&utm_source=community-app-main",
170170
}
171171
}
172172
loggedIn={true}

__tests__/shared/components/__snapshots__/TopcoderFooter.jsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ exports[`Matches shallow shapshot 1`] = `
316316
className="src-shared-components-TopcoderFooter-___style__link___3-nzm"
317317
>
318318
<a
319-
href="https://accounts.topcoder.com/member/registration?utm_source=community&utm_campaign=tc-footer&utm_medium=promotion"
319+
href="https://accounts-auth0.topcoder-dev.com?utm_source=community&utm_campaign=tc-footer&utm_medium=promotion&retUrl="
320320
>
321321
Join Community
322322
</a>

__tests__/shared/components/tc-communities/Footer.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ test('render properly', () => {
4141
<Wrapper
4242
menuItems={[]}
4343
communityId="wipro"
44-
registerUrl="https://accounts.topcoder-dev.com/member/registration"
45-
loginUrl="https://accounts.topcoder-dev.com/member"
44+
registerUrl="https://accounts-auth0.topcoder-dev.com/member/registration"
45+
loginUrl="https://accounts-auth0.topcoder-dev.com/member"
4646
isAuthorized
4747
/>
4848
));
@@ -63,8 +63,8 @@ test('render properly', () => {
6363
url: 'leaderboard',
6464
}]}
6565
communityId="wipro"
66-
registerUrl="https://accounts.topcoder-dev.com/member/registration"
67-
loginUrl="https://accounts.topcoder-dev.com/member"
66+
registerUrl="https://accounts-auth0.topcoder-dev.com/member/registration"
67+
loginUrl="https://accounts-auth0.topcoder-dev.com/member"
6868
isAuthorized={false}
6969
theme={{
7070
container: 'container',

__tests__/shared/components/tc-communities/__snapshots__/AccessDenied.jsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ exports[`Matches shallow shapshot 1`] = `
2020
>
2121
<a
2222
className="tc-btn-md tc-btn-primary"
23-
href="http://accounts.topcoder-dev.com/member?utm_source="
23+
href="https://accounts-auth0.topcoder-dev.com/member?utm_source="
2424
onClick={[Function]}
2525
>
2626
Log In Here

__tests__/shared/reducers/auth.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const mockActions = {
2424
2525
_.merge(actions, mockActions);
2626
27-
jest.setMock('tc-accounts', {
27+
jest.setMock('@topcoder-platform/tc-auth-lib', {
2828
decodeToken: () => 'User object',
2929
isTokenExpired: () => false,
3030
});

__tests__/shared/reducers/challenge.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { mock, actions } from 'topcoder-react-lib';
1111
1212
const { mockAction } = mock;
1313
14-
jest.setMock('tc-accounts', {
14+
jest.setMock('@topcoder-platform/tc-auth-lib', {
1515
decodeToken: () => 'User object',
1616
isTokenExpired: () => false,
1717
});

bin/www

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/* Enables Babel for the server-side code (with exception of this very file). */
66
require('babel-register')({
77
ignore: [
8-
/node_modules\/(?!appirio-tech.*|topcoder|tc-)/,
8+
/node_modules\/(?!appirio-tech.*|topcoder|tc-|@topcoder)/,
99
/node_modules\/topcoder-react-utils/,
1010
],
1111
});

config/default.js

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,6 @@ module.exports = {
7878
},
7979
},
8080

81-
/* Amount of time [seconds] before expiration of authentication tokens,
82-
* when the frontend will automatically trigger their refreshment. Once
83-
* ready, it will either write to the Redux store fresh token, or will
84-
* remove auth tokens from the store.
85-
* NOTE: With the current implementation of accounts-app this value must be
86-
* smaller than 60 seconds (earlier than 60 seconds before expiration of an
87-
* auth token, a call to the getFreshToken() method returns the old token,
88-
* due to caching). */
89-
REAUTH_TIME: 55,
90-
9181
/* API key for Segment.io. For development environment the value is set inside
9282
* development.json, for production environment it is set via CircleCI
9383
* variables. */
@@ -104,7 +94,7 @@ module.exports = {
10494
* platform. */
10595
URL: {
10696
/* Connector URL of the TC accounts App. */
107-
ACCOUNTS_APP_CONNECTOR: 'https://accounts.topcoder-dev.com/connector.html',
97+
ACCOUNTS_APP_CONNECTOR: 'https://accounts-auth0.topcoder-dev.com',
10898

10999
/* The remote address where the app is deployed. */
110100
APP: 'https://community-app.topcoder-dev.com',
@@ -114,7 +104,7 @@ module.exports = {
114104
COMMUNITY_APP: 'https://community-app.topcoder-dev.com',
115105

116106
ARENA: 'https://arena.topcoder-dev.com',
117-
AUTH: 'http://accounts.topcoder-dev.com',
107+
AUTH: 'https://accounts-auth0.topcoder-dev.com',
118108
BASE: 'https://www.topcoder-dev.com',
119109
HOME: '/my-dashboard',
120110
BLOG: 'https://www.topcoder-dev.com/blog',
@@ -129,6 +119,8 @@ module.exports = {
129119
BLOCKCHAIN: 'https://blockchain.topcoder-dev.com',
130120
COGNITIVE: 'https://cognitive.topcoder-dev.com',
131121
ZURICH: 'https://community-app.topcoder-dev.com/__community__/zurich',
122+
COMCAST: 'https://community-app.topcoder-dev.com/__community__/comcast',
123+
CS: 'https://community-app.topcoder-dev.com/__community__/cs',
132124
},
133125

134126
/* Dedicated section to group together links to various articles in
@@ -152,6 +144,7 @@ module.exports = {
152144
STUDIO: 'https://studio.topcoder-dev.com',
153145
TCO: 'https://www.topcoder.com/tco',
154146
TCO17: 'https://tco17.topcoder.com/',
147+
TCO19: 'https://community-app.topcoder-dev.com/__community__/tco19',
155148

156149
TOPGEAR: 'https://dev-topgear.wipro.com',
157150

@@ -384,8 +377,8 @@ module.exports = {
384377
],
385378
HEADER_MENU_THEME: 'light',
386379
HEADER_AUTH_URLS: {
387-
href: 'https://accounts.topcoder-dev.com/member/registration?utm_source=community-app-main',
388-
location: 'https://accounts.topcoder-dev.com/member?retUrl=%S&utm_source=community-app-main',
380+
href: 'https://accounts-auth0.topcoder-dev.com?utm_source=community-app-main',
381+
location: 'https://accounts-auth0.topcoder-dev.com?retUrl=%S&utm_source=community-app-main',
389382
},
390383
ACCOUNT_MENU: [
391384
{

config/jest/default.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const config = require('topcoder-react-utils/config/jest/default');
22
const nodeConfig = require('config');
33

4-
config.transformIgnorePatterns[0] = '/node_modules/(?!appirio-tech|topcoder|tc-)';
4+
config.transformIgnorePatterns[0] = '/node_modules/(?!appirio-tech|topcoder|tc-|@topcoder)';
55
// config.testMatch[0] = '**/__tests__/shared/containers/challenge-listing/FilterPanel.jsx';
66

77
// Include the directories whose tests has been written to minimize coverage time

config/production.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module.exports = {
2626
* as a more verbose name for the param. */
2727
COMMUNITY_APP: 'https://community-app.topcoder.com',
2828

29-
AUTH: 'https://accounts.topcoder.com',
29+
AUTH: 'https://accounts-auth0.topcoder.com',
3030
BASE: 'https://www.topcoder.com',
3131
HOME: '/my-dashboard',
3232
COMMUNITY: 'https://community.topcoder.com',
@@ -39,8 +39,9 @@ module.exports = {
3939
IOS: 'https://ios.topcoder.com',
4040

4141
/* Connector URL of the TC accounts App. */
42-
ACCOUNTS_APP_CONNECTOR: 'https://accounts.topcoder.com/connector.html',
42+
ACCOUNTS_APP_CONNECTOR: 'https://accounts-auth0.topcoder.com/',
4343
TCO17: 'https://tco17.topcoder.com/',
44+
TCO19: 'https://tco19.topcoder.com/',
4445

4546
TOPGEAR: 'https://topgear-app.wipro.com',
4647

@@ -50,6 +51,8 @@ module.exports = {
5051
BLOCKCHAIN: 'https://blockchain.topcoder.com',
5152
COGNITIVE: 'https://cognitive.topcoder.com',
5253
ZURICH: 'https://zurich.topcoder.com',
54+
COMCAST: 'https://comcast.topcoder.com',
55+
CS: 'https://cs.topcoder.com',
5356
},
5457
EMAIL_VERIFY_URL: 'http://www.topcoder.com/settings/account/changeEmail',
5558
},
@@ -184,8 +187,8 @@ module.exports = {
184187
],
185188
HEADER_MENU_THEME: 'light',
186189
HEADER_AUTH_URLS: {
187-
href: 'https://accounts.topcoder.com/member/registration?utm_source=community-app-main',
188-
location: 'https://accounts.topcoder.com/member?retUrl=%S&utm_source=community-app-main',
190+
href: 'https://accounts-auth0.topcoder.com?utm_source=community-app-main',
191+
location: 'https://accounts-auth0.topcoder.com?retUrl=%S&utm_source=community-app-main',
189192
},
190193
ACCOUNT_MENU: [
191194
{

config/webpack/development.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const standardDevelopmentConfig = configFactory({
1717

1818
const jsxRule = standardDevelopmentConfig.module.rules.find(rule => rule.loader === 'babel-loader');
1919
jsxRule.exclude = [
20-
/node_modules[\\/](?!appirio-tech.*|topcoder|tc-)/,
20+
/node_modules[\\/](?!appirio-tech.*|topcoder|tc-|@topcoder)/,
2121
/src[\\/]assets[\\/]fonts/,
2222
/src[\\/]assets[\\/]images[\\/]dashboard/,
2323
];

config/webpack/production.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const standardDevelopmentConfig = configFactory({
2424

2525
const jsxRule = standardDevelopmentConfig.module.rules.find(rule => rule.loader === 'babel-loader');
2626
jsxRule.exclude = [
27-
/node_modules[\\/](?!appirio-tech.*|topcoder|tc-)/,
27+
/node_modules[\\/](?!appirio-tech.*|topcoder|tc-|@topcoder)/,
2828
/src[\\/]assets[\\/]fonts/,
2929
/src[\\/]assets[\\/]images[\\/]dashboard/,
3030
];

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
},
3838
"dependencies": {
3939
"@hapi/joi": "^16.1.4",
40+
"@topcoder-platform/tc-auth-lib": "topcoder-platform/tc-auth-lib#1.0.1",
4041
"aos": "^2.3.4",
4142
"atob": "^2.1.1",
4243
"babel-register": "^6.26.0",
@@ -137,10 +138,9 @@
137138
"showdown": "^1.8.6",
138139
"slick-carousel": "^1.8.1",
139140
"supertest": "^3.1.0",
140-
"tc-accounts": "git+https://github.com/appirio-tech/accounts-app.git#dev",
141141
"tc-core-library-js": "github:appirio-tech/tc-core-library-js#v2.6.3",
142142
"tc-ui": "^1.0.12",
143-
"topcoder-react-lib": "1.0.8",
143+
"topcoder-react-lib": "1.1.0",
144144
"topcoder-react-ui-kit": "2.0.1",
145145
"topcoder-react-utils": "0.7.8",
146146
"turndown": "^4.0.2",

src/client/index.jsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
configureConnector,
1212
decodeToken,
1313
getFreshToken,
14-
} from 'tc-accounts';
14+
} from '@topcoder-platform/tc-auth-lib';
1515
import { actions, logger, errors } from 'topcoder-react-lib';
1616
import { client, redux } from 'topcoder-react-utils';
1717

@@ -113,10 +113,9 @@ function authenticate(store) {
113113
if (tctV2) time = decodeToken(tctV2).exp;
114114
if (userV3) time = Math.min(time, userV3.exp);
115115
if (time < Number.MAX_VALUE) {
116-
time = 1000 * (time - window.CONFIG.REAUTH_TIME);
117-
time = Math.max(0, time - Date.now());
116+
time = Math.max(1000, (time * 1000) - Date.now());
118117
logger.log('Reauth scheduled in', time / 1000, 'seconds');
119-
setTimeout(() => authenticate(store), time);
118+
setTimeout(() => authenticate(store), time + 1000);
120119
}
121120
});
122121
}

src/shared/actions/challenge-listing/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import _ from 'lodash';
66
import { createActions } from 'redux-actions';
7-
import { decodeToken } from 'tc-accounts';
7+
import { decodeToken } from '@topcoder-platform/tc-auth-lib';
88
import 'isomorphic-fetch';
99
import { processSRM } from 'utils/tc';
1010
import { errors, services } from 'topcoder-react-lib';
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/**
2+
* High order component that apply front-side password protection
3+
* before loading a Contentful Viewport. It uses sessionStorage for working.
4+
*/
5+
import PT from 'prop-types';
6+
import React from 'react';
7+
import Viewport from 'components/Contentful/Viewport';
8+
import TextInput from 'components/GUIKit/TextInput';
9+
10+
import './style.scss';
11+
12+
export default class PasswordScreen extends React.Component {
13+
state = {};
14+
15+
constructor(props) {
16+
super(props);
17+
18+
this.onSubmit = this.onSubmit.bind(this);
19+
this.onPasswordInput = this.onPasswordInput.bind(this);
20+
}
21+
22+
onSubmit() {
23+
const { password } = this.props;
24+
const { inputVal } = this.state;
25+
this.setState({
26+
authorized: password === inputVal,
27+
errorMsg: password === inputVal ? '' : 'Password incorrect',
28+
});
29+
}
30+
31+
onPasswordInput(inputVal) {
32+
const update = {
33+
inputVal,
34+
};
35+
if (!inputVal) update.errorMsg = '';
36+
this.setState(update);
37+
}
38+
39+
render() {
40+
const {
41+
authorized, errorMsg, inputVal,
42+
} = this.state;
43+
const {
44+
viewPortId, preview, spaceName, environment, baseUrl, title,
45+
} = this.props;
46+
return authorized ? (
47+
<Viewport
48+
id={viewPortId}
49+
preview={preview}
50+
spaceName={spaceName}
51+
environment={environment}
52+
baseUrl={baseUrl}
53+
/>
54+
) : (
55+
<div styleName="wrapper">
56+
<div styleName="container">
57+
<h4>{title || 'GET ACCESS WITH PASSWORD'}</h4>
58+
<p styleName="hint">Please enter the password you were provided</p>
59+
<TextInput
60+
placeholder="Password"
61+
label="Password"
62+
onChange={val => this.onPasswordInput(val)}
63+
errorMsg={errorMsg}
64+
required
65+
/>
66+
<div styleName="cta">
67+
<button type="button" styleName="submit" onClick={this.onSubmit} disabled={!inputVal}>SUBMIT</button>
68+
</div>
69+
</div>
70+
</div>
71+
);
72+
}
73+
}
74+
75+
PasswordScreen.defaultProps = {
76+
preview: false,
77+
spaceName: null,
78+
environment: null,
79+
baseUrl: '',
80+
title: 'GET ACCESS WITH PASSWORD',
81+
};
82+
83+
PasswordScreen.propTypes = {
84+
password: PT.string.isRequired,
85+
viewPortId: PT.string.isRequired,
86+
preview: PT.bool,
87+
spaceName: PT.string,
88+
environment: PT.string,
89+
baseUrl: PT.string,
90+
title: PT.string,
91+
};

0 commit comments

Comments
 (0)