From e17f656211e94baffc1d2660272e8998e4ac0191 Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Fri, 4 Sep 2020 18:44:45 +0530 Subject: [PATCH 01/35] new auth0 url --- config/default.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/default.js b/config/default.js index e9c1df07aa..bf9a109720 100644 --- a/config/default.js +++ b/config/default.js @@ -382,8 +382,8 @@ module.exports = { ], HEADER_MENU_THEME: 'light', HEADER_AUTH_URLS: { - href: 'https://accounts.topcoder-dev.com/member/registration?utm_source=community-app-main', - location: 'https://accounts.topcoder-dev.com/member?retUrl=%S&utm_source=community-app-main', + href: 'https://accounts-auth0.topcoder-dev.com?utm_source=community-app-main', + location: 'https://accounts-auth0.topcoder-dev.com?retUrl=%S&utm_source=community-app-main', }, ACCOUNT_MENU: [ { From ba6c11f79c049245b84931c002a9a6eaa8b4a1dc Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Fri, 4 Sep 2020 19:04:13 +0530 Subject: [PATCH 02/35] just for bypassing condition - https://github.com/topcoder-platform/navigation-component/blob/develop/src/components/LoginNav/index.js#L125 --- config/default.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/default.js b/config/default.js index bf9a109720..435dedbe95 100644 --- a/config/default.js +++ b/config/default.js @@ -383,7 +383,7 @@ module.exports = { HEADER_MENU_THEME: 'light', HEADER_AUTH_URLS: { href: 'https://accounts-auth0.topcoder-dev.com?utm_source=community-app-main', - location: 'https://accounts-auth0.topcoder-dev.com?retUrl=%S&utm_source=community-app-main', + location: 'https://accounts-auth0.topcoder-dev.com?retUrl=%S&utm_source=community-app-main&member?', }, ACCOUNT_MENU: [ { From 038a06fe62461378f17433a0161a01457b793f79 Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Mon, 7 Sep 2020 18:28:31 +0530 Subject: [PATCH 03/35] fixing unit testing --- .../shared/components/Header/__snapshots__/index.jsx.snap | 4 ++-- config/default.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/__tests__/shared/components/Header/__snapshots__/index.jsx.snap b/__tests__/shared/components/Header/__snapshots__/index.jsx.snap index 9f0f7a4186..fc7cd4c064 100644 --- a/__tests__/shared/components/Header/__snapshots__/index.jsx.snap +++ b/__tests__/shared/components/Header/__snapshots__/index.jsx.snap @@ -162,8 +162,8 @@ exports[`Default render 1`] = ` auth={null} authURLs={ Object { - "href": "https://accounts.topcoder-dev.com/member/registration?utm_source=community-app-main", - "location": "https://accounts.topcoder-dev.com/member?retUrl=%S&utm_source=community-app-main", + "href": "https://accounts-auth0.topcoder-dev.com?utm_source=community-app-main", + "location": "https://accounts-auth0.topcoder-dev.com?retUrl=%S&utm_source=community-app-main", } } loggedIn={true} diff --git a/config/default.js b/config/default.js index 435dedbe95..bf9a109720 100644 --- a/config/default.js +++ b/config/default.js @@ -383,7 +383,7 @@ module.exports = { HEADER_MENU_THEME: 'light', HEADER_AUTH_URLS: { href: 'https://accounts-auth0.topcoder-dev.com?utm_source=community-app-main', - location: 'https://accounts-auth0.topcoder-dev.com?retUrl=%S&utm_source=community-app-main&member?', + location: 'https://accounts-auth0.topcoder-dev.com?retUrl=%S&utm_source=community-app-main', }, ACCOUNT_MENU: [ { From 238edf3845ea390075f9895e04937280957e37b0 Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Tue, 8 Sep 2020 18:31:28 +0530 Subject: [PATCH 04/35] adding changes for new auth flow --- .circleci/config.yml | 1 + __tests__/client/client.jsx | 2 +- __tests__/shared/reducers/auth.js | 2 +- __tests__/shared/reducers/challenge.js | 2 +- config/default.js | 2 +- package.json | 2 +- src/client/index.jsx | 2 +- src/shared/actions/challenge-listing/index.js | 2 +- src/shared/components/challenge-detail/MySubmissions/index.jsx | 2 +- src/shared/components/challenge-detail/Submissions/index.jsx | 2 +- src/shared/containers/Dashboard/index.jsx | 2 +- src/shared/containers/EmailVerification/index.jsx | 2 +- src/shared/containers/Settings.jsx | 2 +- src/shared/reducers/tc-communities/index.js | 2 +- src/shared/utils/tc.js | 2 +- 15 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d9e4f88a90..f98f1a1084 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -239,6 +239,7 @@ workflows: only: - feature-contentful - hot-fix + - feature/auth0-RS256-Idtoken # This is alternate dev env for parallel testing - "build-qa": context : org-global diff --git a/__tests__/client/client.jsx b/__tests__/client/client.jsx index cf90a63944..f76a304068 100644 --- a/__tests__/client/client.jsx +++ b/__tests__/client/client.jsx @@ -106,7 +106,7 @@ const mockTcAccounts = { decodeToken: () => ({ exp: Date.now() }), getFreshToken: () => Promise.resolve(tokenV3), }; -jest.setMock('tc-accounts', mockTcAccounts); +jest.setMock('tc-auth-lib', mockTcAccounts); /* Mock auth actions */ /* diff --git a/__tests__/shared/reducers/auth.js b/__tests__/shared/reducers/auth.js index 5427774916..d6c9f923bc 100644 --- a/__tests__/shared/reducers/auth.js +++ b/__tests__/shared/reducers/auth.js @@ -24,7 +24,7 @@ const mockActions = { _.merge(actions, mockActions); -jest.setMock('tc-accounts', { +jest.setMock('tc-auth-lib', { decodeToken: () => 'User object', isTokenExpired: () => false, }); diff --git a/__tests__/shared/reducers/challenge.js b/__tests__/shared/reducers/challenge.js index dab9dd39c0..a65d45fea6 100644 --- a/__tests__/shared/reducers/challenge.js +++ b/__tests__/shared/reducers/challenge.js @@ -11,7 +11,7 @@ import { mock, actions } from 'topcoder-react-lib'; const { mockAction } = mock; -jest.setMock('tc-accounts', { +jest.setMock('tc-auth-lib', { decodeToken: () => 'User object', isTokenExpired: () => false, }); diff --git a/config/default.js b/config/default.js index bf9a109720..e28c1030a2 100644 --- a/config/default.js +++ b/config/default.js @@ -104,7 +104,7 @@ module.exports = { * platform. */ URL: { /* Connector URL of the TC accounts App. */ - ACCOUNTS_APP_CONNECTOR: 'https://accounts.topcoder-dev.com/connector.html', + ACCOUNTS_APP_CONNECTOR: 'https://accounts-auth0.topcoder-dev.com', /* The remote address where the app is deployed. */ APP: 'https://community-app.topcoder-dev.com', diff --git a/package.json b/package.json index d284ae8360..d44fbbc9a3 100644 --- a/package.json +++ b/package.json @@ -134,7 +134,7 @@ "showdown": "^1.8.6", "slick-carousel": "^1.8.1", "supertest": "^3.1.0", - "tc-accounts": "git+https://github.com/appirio-tech/accounts-app.git#dev", + "tc-auth-lib": "git+https://github.com/topcoder-platform/tc-auth-lib.git#master", "tc-core-library-js": "github:appirio-tech/tc-core-library-js#v2.6.3", "tc-ui": "^1.0.12", "topcoder-react-lib": "1.0.3", diff --git a/src/client/index.jsx b/src/client/index.jsx index c5ad157536..62f6f7063d 100644 --- a/src/client/index.jsx +++ b/src/client/index.jsx @@ -11,7 +11,7 @@ import { configureConnector, decodeToken, getFreshToken, -} from 'tc-accounts'; +} from 'tc-auth-lib'; import { actions, logger, errors } from 'topcoder-react-lib'; import { client, redux } from 'topcoder-react-utils'; diff --git a/src/shared/actions/challenge-listing/index.js b/src/shared/actions/challenge-listing/index.js index a33623e9b7..c03710a480 100644 --- a/src/shared/actions/challenge-listing/index.js +++ b/src/shared/actions/challenge-listing/index.js @@ -4,7 +4,7 @@ import _ from 'lodash'; import { createActions } from 'redux-actions'; -import { decodeToken } from 'tc-accounts'; +import { decodeToken } from 'tc-auth-lib'; import 'isomorphic-fetch'; import { processSRM } from 'utils/tc'; import { errors, services } from 'topcoder-react-lib'; diff --git a/src/shared/components/challenge-detail/MySubmissions/index.jsx b/src/shared/components/challenge-detail/MySubmissions/index.jsx index 8687914a85..a450dd32cf 100644 --- a/src/shared/components/challenge-detail/MySubmissions/index.jsx +++ b/src/shared/components/challenge-detail/MySubmissions/index.jsx @@ -7,7 +7,7 @@ import PT from 'prop-types'; import _ from 'lodash'; import { goToLogin } from 'utils/tc'; import LoadingIndicator from 'components/LoadingIndicator'; -import { isTokenExpired } from 'tc-accounts'; +import { isTokenExpired } from 'tc-auth-lib'; import SubmissionsList from './SubmissionsList'; import SubmissionsDetail from './SubmissionsDetail'; diff --git a/src/shared/components/challenge-detail/Submissions/index.jsx b/src/shared/components/challenge-detail/Submissions/index.jsx index bf0beda012..f3ead12c3f 100644 --- a/src/shared/components/challenge-detail/Submissions/index.jsx +++ b/src/shared/components/challenge-detail/Submissions/index.jsx @@ -11,7 +11,7 @@ import _ from 'lodash'; import { connect } from 'react-redux'; import { config } from 'topcoder-react-utils'; import { submission as submissionUtils } from 'topcoder-react-lib'; -import { isTokenExpired } from 'tc-accounts'; +import { isTokenExpired } from 'tc-auth-lib'; import cn from 'classnames'; import { PrimaryButton } from 'topcoder-react-ui-kit'; diff --git a/src/shared/containers/Dashboard/index.jsx b/src/shared/containers/Dashboard/index.jsx index 866cc83742..6e4cd40ad3 100644 --- a/src/shared/containers/Dashboard/index.jsx +++ b/src/shared/containers/Dashboard/index.jsx @@ -25,7 +25,7 @@ import { updateChallengeType } from 'utils/challenge'; import challengeListingActions from 'actions/challenge-listing'; import communityActions from 'actions/tc-communities'; -import { isTokenExpired, decodeToken } from 'tc-accounts'; +import { isTokenExpired, decodeToken } from 'tc-auth-lib'; import { config, isomorphy } from 'topcoder-react-utils'; import './styles.scss'; diff --git a/src/shared/containers/EmailVerification/index.jsx b/src/shared/containers/EmailVerification/index.jsx index 66bc337c4b..eee56a96e5 100644 --- a/src/shared/containers/EmailVerification/index.jsx +++ b/src/shared/containers/EmailVerification/index.jsx @@ -8,7 +8,7 @@ import PT from 'prop-types'; import {connect} from "react-redux"; import { actions } from "topcoder-react-lib"; import { Redirect } from 'react-router'; -import {isTokenExpired} from "tc-accounts"; +import {isTokenExpired} from "tc-auth-lib"; import * as queryString from 'query-string'; import LoadingIndicator from 'components/LoadingIndicator'; import Error404 from 'components/Error404'; diff --git a/src/shared/containers/Settings.jsx b/src/shared/containers/Settings.jsx index 40009cef92..1d43a99cb0 100644 --- a/src/shared/containers/Settings.jsx +++ b/src/shared/containers/Settings.jsx @@ -6,7 +6,7 @@ import React from 'react'; import PT from 'prop-types'; import { connect } from 'react-redux'; -import { isTokenExpired } from 'tc-accounts'; +import { isTokenExpired } from 'tc-auth-lib'; import { goToLogin } from 'utils/tc'; import { actions } from 'topcoder-react-lib'; diff --git a/src/shared/reducers/tc-communities/index.js b/src/shared/reducers/tc-communities/index.js index b915416d12..c7db77ae7f 100644 --- a/src/shared/reducers/tc-communities/index.js +++ b/src/shared/reducers/tc-communities/index.js @@ -8,7 +8,7 @@ import _ from 'lodash'; import actions from 'actions/tc-communities'; import { logger, services, errors } from 'topcoder-react-lib'; import { handleActions } from 'redux-actions'; -import { decodeToken } from 'tc-accounts'; +import { decodeToken } from 'tc-auth-lib'; import { getAuthTokens } from 'utils/tc'; import { STATE as JOIN_COMMUNITY } from 'components/tc-communities/JoinCommunity'; import { getCommunityId } from 'server/services/communities'; diff --git a/src/shared/utils/tc.js b/src/shared/utils/tc.js index 92c93c9ca6..8aff2c8620 100644 --- a/src/shared/utils/tc.js +++ b/src/shared/utils/tc.js @@ -5,7 +5,7 @@ import _ from 'lodash'; import moment from 'moment-timezone'; -import { isTokenExpired } from 'tc-accounts'; +import { isTokenExpired } from 'tc-auth-lib'; import { config, isomorphy } from 'topcoder-react-utils'; import { tc } from 'topcoder-react-lib'; From a39e6a5a41c7324057170fe46b61cff66b43c58c Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Tue, 8 Sep 2020 18:32:56 +0530 Subject: [PATCH 05/35] fixing yml issue --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f98f1a1084..fc46543324 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -239,7 +239,7 @@ workflows: only: - feature-contentful - hot-fix - - feature/auth0-RS256-Idtoken + - "feature/auth0-RS256-Idtoken" # This is alternate dev env for parallel testing - "build-qa": context : org-global From 378bf27fea21a7ed6531e68a9ce62b7a6f027cd6 Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Tue, 8 Sep 2020 18:40:11 +0530 Subject: [PATCH 06/35] fixing yml issue --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fc46543324..2f07684bdc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -239,7 +239,7 @@ workflows: only: - feature-contentful - hot-fix - - "feature/auth0-RS256-Idtoken" + - feature/auth0-RS256-Idtoken # This is alternate dev env for parallel testing - "build-qa": context : org-global From 6d48664e5a830cd1348f7a0eb036ef2971ca4270 Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Wed, 9 Sep 2020 10:57:06 +0530 Subject: [PATCH 07/35] deploying after fixing lodash issue --- .circleci/config.yml | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2f07684bdc..a343bd7998 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -239,7 +239,6 @@ workflows: only: - feature-contentful - hot-fix - - feature/auth0-RS256-Idtoken # This is alternate dev env for parallel testing - "build-qa": context : org-global @@ -247,6 +246,7 @@ workflows: branches: only: - hot-fix + - feature/auth0-RS256-Idtoken # This is beta env for production soft releases - "build-prod-beta": context : org-global diff --git a/package.json b/package.json index d44fbbc9a3..eb813abc3f 100644 --- a/package.json +++ b/package.json @@ -134,7 +134,7 @@ "showdown": "^1.8.6", "slick-carousel": "^1.8.1", "supertest": "^3.1.0", - "tc-auth-lib": "git+https://github.com/topcoder-platform/tc-auth-lib.git#master", + "tc-auth-lib": "git+https://github.com/topcoder-platform/tc-auth-lib.git#div", "tc-core-library-js": "github:appirio-tech/tc-core-library-js#v2.6.3", "tc-ui": "^1.0.12", "topcoder-react-lib": "1.0.3", From 5a4fe97ff8bab1999ff382a1733771f14d227e74 Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Wed, 9 Sep 2020 11:06:32 +0530 Subject: [PATCH 08/35] typo --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index eb813abc3f..8614c28c13 100644 --- a/package.json +++ b/package.json @@ -134,7 +134,7 @@ "showdown": "^1.8.6", "slick-carousel": "^1.8.1", "supertest": "^3.1.0", - "tc-auth-lib": "git+https://github.com/topcoder-platform/tc-auth-lib.git#div", + "tc-auth-lib": "git+https://github.com/topcoder-platform/tc-auth-lib.git#dev", "tc-core-library-js": "github:appirio-tech/tc-core-library-js#v2.6.3", "tc-ui": "^1.0.12", "topcoder-react-lib": "1.0.3", From 599b2363f2c720c324aaaef81a7a0303a600cbb1 Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Wed, 9 Sep 2020 13:57:26 +0530 Subject: [PATCH 09/35] changing auth url --- config/default.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/default.js b/config/default.js index e28c1030a2..4731b7a42f 100644 --- a/config/default.js +++ b/config/default.js @@ -114,7 +114,7 @@ module.exports = { COMMUNITY_APP: 'https://community-app.topcoder-dev.com', ARENA: 'https://arena.topcoder-dev.com', - AUTH: 'http://accounts.topcoder-dev.com', + AUTH: 'http://accounts-auth0.topcoder-dev.com', BASE: 'https://www.topcoder-dev.com', HOME: '/my-dashboard', BLOG: 'https://www.topcoder-dev.com/blog', From 59b480019ff8e462295352bcc2c43609ab78e136 Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Wed, 9 Sep 2020 14:52:22 +0530 Subject: [PATCH 10/35] fixing unit test --- __tests__/shared/components/tc-communities/Footer.jsx | 8 ++++---- .../tc-communities/__snapshots__/AccessDenied.jsx.snap | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/__tests__/shared/components/tc-communities/Footer.jsx b/__tests__/shared/components/tc-communities/Footer.jsx index 4145cb1dfe..4af4808c33 100644 --- a/__tests__/shared/components/tc-communities/Footer.jsx +++ b/__tests__/shared/components/tc-communities/Footer.jsx @@ -41,8 +41,8 @@ test('render properly', () => { )); @@ -63,8 +63,8 @@ test('render properly', () => { url: 'leaderboard', }]} communityId="wipro" - registerUrl="https://accounts.topcoder-dev.com/member/registration" - loginUrl="https://accounts.topcoder-dev.com/member" + registerUrl="https://accounts-auth0.topcoder-dev.com/member/registration" + loginUrl="https://accounts-auth0.topcoder-dev.com/member" isAuthorized={false} theme={{ container: 'container', diff --git a/__tests__/shared/components/tc-communities/__snapshots__/AccessDenied.jsx.snap b/__tests__/shared/components/tc-communities/__snapshots__/AccessDenied.jsx.snap index 407702adeb..fd1738a2b8 100644 --- a/__tests__/shared/components/tc-communities/__snapshots__/AccessDenied.jsx.snap +++ b/__tests__/shared/components/tc-communities/__snapshots__/AccessDenied.jsx.snap @@ -20,7 +20,7 @@ exports[`Matches shallow shapshot 1`] = ` > Log In Here From 4119aca54e3adec7a27f5818d96600e333bc85f4 Mon Sep 17 00:00:00 2001 From: Sushil Shinde Date: Fri, 18 Sep 2020 11:32:15 +0530 Subject: [PATCH 11/35] ci: deploying to stage and dev envs --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e732204bfc..785062d248 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -230,7 +230,7 @@ workflows: filters: branches: only: - - milestone-20200924 + - feature/auth0-RS256-Idtoken - develop # This is alternate dev env for parallel testing - "build-test": @@ -247,7 +247,6 @@ workflows: branches: only: - hot-fix - - feature/auth0-RS256-Idtoken - community-app-tests-poc # This is beta env for production soft releases - "build-prod-beta": @@ -264,6 +263,7 @@ workflows: branches: only: - develop + - feature/auth0-RS256-Idtoken # Production builds are exectuted # when PR is merged to the master # Don't change anything in this configuration From ca7459ead9c06c7cbc32dbeb9cab8eed15b1ceb6 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Fri, 18 Sep 2020 09:27:50 -0300 Subject: [PATCH 12/35] Remove reauth from Frontend --- config/default.js | 10 ---------- src/client/index.jsx | 11 ----------- 2 files changed, 21 deletions(-) diff --git a/config/default.js b/config/default.js index bd492b5fe5..7a13130ea4 100644 --- a/config/default.js +++ b/config/default.js @@ -78,16 +78,6 @@ module.exports = { }, }, - /* Amount of time [seconds] before expiration of authentication tokens, - * when the frontend will automatically trigger their refreshment. Once - * ready, it will either write to the Redux store fresh token, or will - * remove auth tokens from the store. - * NOTE: With the current implementation of accounts-app this value must be - * smaller than 60 seconds (earlier than 60 seconds before expiration of an - * auth token, a call to the getFreshToken() method returns the old token, - * due to caching). */ - REAUTH_TIME: 55, - /* API key for Segment.io. For development environment the value is set inside * development.json, for production environment it is set via CircleCI * variables. */ diff --git a/src/client/index.jsx b/src/client/index.jsx index 62f6f7063d..fa47d92f3d 100644 --- a/src/client/index.jsx +++ b/src/client/index.jsx @@ -107,17 +107,6 @@ function authenticate(store) { store.dispatch(actions.direct.dropAll()); store.dispatch(actions.groups.dropGroups()); } - - /* Automatic refreshment of auth tokens. */ - let time = Number.MAX_VALUE; - if (tctV2) time = decodeToken(tctV2).exp; - if (userV3) time = Math.min(time, userV3.exp); - if (time < Number.MAX_VALUE) { - time = 1000 * (time - window.CONFIG.REAUTH_TIME); - time = Math.max(0, time - Date.now()); - logger.log('Reauth scheduled in', time / 1000, 'seconds'); - setTimeout(() => authenticate(store), time); - } }); } From e84f2cffbbaab1ef6a439eb28349e9a14bf60495 Mon Sep 17 00:00:00 2001 From: Sushil Shinde Date: Tue, 22 Sep 2020 14:06:16 +0530 Subject: [PATCH 13/35] fix: prod auth0 domain url --- config/production.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/production.js b/config/production.js index 405c90e93b..0d00edd90e 100644 --- a/config/production.js +++ b/config/production.js @@ -39,7 +39,7 @@ module.exports = { IOS: 'https://ios.topcoder.com', /* Connector URL of the TC accounts App. */ - ACCOUNTS_APP_CONNECTOR: 'https://accounts.topcoder.com/connector.html', + ACCOUNTS_APP_CONNECTOR: 'https://accounts-auth0.topcoder.com/', TCO17: 'https://tco17.topcoder.com/', TOPGEAR: 'https://topgear-app.wipro.com', From db61f478d08c8c5d6f80f1baaf50be6b70fc29b1 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Tue, 22 Sep 2020 06:08:42 -0300 Subject: [PATCH 14/35] Re added refresh token to community-app --- src/client/index.jsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/client/index.jsx b/src/client/index.jsx index fa47d92f3d..39af362f28 100644 --- a/src/client/index.jsx +++ b/src/client/index.jsx @@ -107,6 +107,16 @@ function authenticate(store) { store.dispatch(actions.direct.dropAll()); store.dispatch(actions.groups.dropGroups()); } + + /* Automatic refreshment of auth tokens. */ + let time = Number.MAX_VALUE; + if (tctV2) time = decodeToken(tctV2).exp; + if (userV3) time = Math.min(time, userV3.exp); + if (time < Number.MAX_VALUE) { + time = Math.max(1000, (time * 1000) - Date.now()); + logger.log('Reauth scheduled in', time / 1000, 'seconds'); + setTimeout(() => authenticate(store), time + 1000); + } }); } From f6e5c5ed70ed9b4edfa416a944cd85684159d52a Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Tue, 22 Sep 2020 06:35:47 -0300 Subject: [PATCH 15/35] Fix Prod Auth0 url's --- config/production.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/production.js b/config/production.js index 0d00edd90e..a2c654155e 100644 --- a/config/production.js +++ b/config/production.js @@ -26,7 +26,7 @@ module.exports = { * as a more verbose name for the param. */ COMMUNITY_APP: 'https://community-app.topcoder.com', - AUTH: 'https://accounts.topcoder.com', + AUTH: 'http://accounts-auth0.topcoder.com', BASE: 'https://www.topcoder.com', HOME: '/my-dashboard', COMMUNITY: 'https://community.topcoder.com', @@ -184,8 +184,8 @@ module.exports = { ], HEADER_MENU_THEME: 'light', HEADER_AUTH_URLS: { - href: 'https://accounts.topcoder.com/member/registration?utm_source=community-app-main', - location: 'https://accounts.topcoder.com/member?retUrl=%S&utm_source=community-app-main', + href: 'https://accounts-auth0.topcoder.com?utm_source=community-app-main', + location: 'https://accounts-auth0.topcoder.com?retUrl=%S&utm_source=community-app-main', }, ACCOUNT_MENU: [ { From ac734d744a0d0ca2fb0782750f18a260df0d7b3f Mon Sep 17 00:00:00 2001 From: Luiz Ricardo Rodrigues Date: Tue, 22 Sep 2020 10:39:42 -0300 Subject: [PATCH 16/35] Fix https to Auth --- config/production.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/production.js b/config/production.js index a2c654155e..f8c8e7ccae 100644 --- a/config/production.js +++ b/config/production.js @@ -26,7 +26,7 @@ module.exports = { * as a more verbose name for the param. */ COMMUNITY_APP: 'https://community-app.topcoder.com', - AUTH: 'http://accounts-auth0.topcoder.com', + AUTH: 'https://accounts-auth0.topcoder.com', BASE: 'https://www.topcoder.com', HOME: '/my-dashboard', COMMUNITY: 'https://community.topcoder.com', From 95c327c5a3c7a3b804faa9d8aaee89961a2a7e69 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Tue, 22 Sep 2020 10:56:41 -0300 Subject: [PATCH 17/35] Fix URL.AUTH https to Dev --- config/default.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/default.js b/config/default.js index 7a13130ea4..9e0dc95422 100644 --- a/config/default.js +++ b/config/default.js @@ -104,7 +104,7 @@ module.exports = { COMMUNITY_APP: 'https://community-app.topcoder-dev.com', ARENA: 'https://arena.topcoder-dev.com', - AUTH: 'http://accounts-auth0.topcoder-dev.com', + AUTH: 'https://accounts-auth0.topcoder-dev.com', BASE: 'https://www.topcoder-dev.com', HOME: '/my-dashboard', BLOG: 'https://www.topcoder-dev.com/blog', From dcc3aa1a3776d156ea559cc18cd0b688ac886893 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Tue, 22 Sep 2020 11:04:56 -0300 Subject: [PATCH 18/35] Fix snapshot --- .../tc-communities/__snapshots__/AccessDenied.jsx.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tests__/shared/components/tc-communities/__snapshots__/AccessDenied.jsx.snap b/__tests__/shared/components/tc-communities/__snapshots__/AccessDenied.jsx.snap index fd1738a2b8..389cd6e649 100644 --- a/__tests__/shared/components/tc-communities/__snapshots__/AccessDenied.jsx.snap +++ b/__tests__/shared/components/tc-communities/__snapshots__/AccessDenied.jsx.snap @@ -20,7 +20,7 @@ exports[`Matches shallow shapshot 1`] = ` > Log In Here From 5970c2135fc6d0c8b42f7e4d6bd31c1734ea7e4d Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Wed, 30 Sep 2020 10:52:58 -0300 Subject: [PATCH 19/35] Updated tc-auth-lib name --- package.json | 2 +- src/client/index.jsx | 2 +- src/shared/actions/challenge-listing/index.js | 2 +- src/shared/components/challenge-detail/MySubmissions/index.jsx | 2 +- src/shared/components/challenge-detail/Submissions/index.jsx | 2 +- src/shared/containers/Dashboard/index.jsx | 2 +- src/shared/containers/Settings.jsx | 2 +- src/shared/reducers/tc-communities/index.js | 2 +- src/shared/utils/tc.js | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index dda4a674af..a0c732f77b 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ }, "dependencies": { "@hapi/joi": "^16.1.4", + "@topcoder-platform/tc-auth-lib": "topcoder-platform/tc-auth-lib#1.0.1", "aos": "^2.3.4", "atob": "^2.1.1", "babel-register": "^6.26.0", @@ -134,7 +135,6 @@ "showdown": "^1.8.6", "slick-carousel": "^1.8.1", "supertest": "^3.1.0", - "tc-auth-lib": "git+https://github.com/topcoder-platform/tc-auth-lib.git#dev", "tc-core-library-js": "github:appirio-tech/tc-core-library-js#v2.6.3", "tc-ui": "^1.0.12", "topcoder-react-lib": "1.0.5", diff --git a/src/client/index.jsx b/src/client/index.jsx index 39af362f28..b44745e76e 100644 --- a/src/client/index.jsx +++ b/src/client/index.jsx @@ -11,7 +11,7 @@ import { configureConnector, decodeToken, getFreshToken, -} from 'tc-auth-lib'; +} from '@topcoder-platform/tc-auth-lib'; import { actions, logger, errors } from 'topcoder-react-lib'; import { client, redux } from 'topcoder-react-utils'; diff --git a/src/shared/actions/challenge-listing/index.js b/src/shared/actions/challenge-listing/index.js index c03710a480..2e0ac3e5cd 100644 --- a/src/shared/actions/challenge-listing/index.js +++ b/src/shared/actions/challenge-listing/index.js @@ -4,7 +4,7 @@ import _ from 'lodash'; import { createActions } from 'redux-actions'; -import { decodeToken } from 'tc-auth-lib'; +import { decodeToken } from '@topcoder-platform/tc-auth-lib'; import 'isomorphic-fetch'; import { processSRM } from 'utils/tc'; import { errors, services } from 'topcoder-react-lib'; diff --git a/src/shared/components/challenge-detail/MySubmissions/index.jsx b/src/shared/components/challenge-detail/MySubmissions/index.jsx index a450dd32cf..824b29d0d6 100644 --- a/src/shared/components/challenge-detail/MySubmissions/index.jsx +++ b/src/shared/components/challenge-detail/MySubmissions/index.jsx @@ -7,7 +7,7 @@ import PT from 'prop-types'; import _ from 'lodash'; import { goToLogin } from 'utils/tc'; import LoadingIndicator from 'components/LoadingIndicator'; -import { isTokenExpired } from 'tc-auth-lib'; +import { isTokenExpired } from '@topcoder-platform/tc-auth-lib'; import SubmissionsList from './SubmissionsList'; import SubmissionsDetail from './SubmissionsDetail'; diff --git a/src/shared/components/challenge-detail/Submissions/index.jsx b/src/shared/components/challenge-detail/Submissions/index.jsx index f3ead12c3f..380e3cf9ac 100644 --- a/src/shared/components/challenge-detail/Submissions/index.jsx +++ b/src/shared/components/challenge-detail/Submissions/index.jsx @@ -11,7 +11,7 @@ import _ from 'lodash'; import { connect } from 'react-redux'; import { config } from 'topcoder-react-utils'; import { submission as submissionUtils } from 'topcoder-react-lib'; -import { isTokenExpired } from 'tc-auth-lib'; +import { isTokenExpired } from '@topcoder-platform/tc-auth-lib'; import cn from 'classnames'; import { PrimaryButton } from 'topcoder-react-ui-kit'; diff --git a/src/shared/containers/Dashboard/index.jsx b/src/shared/containers/Dashboard/index.jsx index 6e4cd40ad3..915e98ac74 100644 --- a/src/shared/containers/Dashboard/index.jsx +++ b/src/shared/containers/Dashboard/index.jsx @@ -25,7 +25,7 @@ import { updateChallengeType } from 'utils/challenge'; import challengeListingActions from 'actions/challenge-listing'; import communityActions from 'actions/tc-communities'; -import { isTokenExpired, decodeToken } from 'tc-auth-lib'; +import { isTokenExpired, decodeToken } from '@topcoder-platform/tc-auth-lib'; import { config, isomorphy } from 'topcoder-react-utils'; import './styles.scss'; diff --git a/src/shared/containers/Settings.jsx b/src/shared/containers/Settings.jsx index 1d43a99cb0..dcbaf86ad0 100644 --- a/src/shared/containers/Settings.jsx +++ b/src/shared/containers/Settings.jsx @@ -6,7 +6,7 @@ import React from 'react'; import PT from 'prop-types'; import { connect } from 'react-redux'; -import { isTokenExpired } from 'tc-auth-lib'; +import { isTokenExpired } from '@topcoder-platform/tc-auth-lib'; import { goToLogin } from 'utils/tc'; import { actions } from 'topcoder-react-lib'; diff --git a/src/shared/reducers/tc-communities/index.js b/src/shared/reducers/tc-communities/index.js index c7db77ae7f..5ab21acf3d 100644 --- a/src/shared/reducers/tc-communities/index.js +++ b/src/shared/reducers/tc-communities/index.js @@ -8,7 +8,7 @@ import _ from 'lodash'; import actions from 'actions/tc-communities'; import { logger, services, errors } from 'topcoder-react-lib'; import { handleActions } from 'redux-actions'; -import { decodeToken } from 'tc-auth-lib'; +import { decodeToken } from '@topcoder-platform/tc-auth-lib'; import { getAuthTokens } from 'utils/tc'; import { STATE as JOIN_COMMUNITY } from 'components/tc-communities/JoinCommunity'; import { getCommunityId } from 'server/services/communities'; diff --git a/src/shared/utils/tc.js b/src/shared/utils/tc.js index 8aff2c8620..305b783cad 100644 --- a/src/shared/utils/tc.js +++ b/src/shared/utils/tc.js @@ -5,7 +5,7 @@ import _ from 'lodash'; import moment from 'moment-timezone'; -import { isTokenExpired } from 'tc-auth-lib'; +import { isTokenExpired } from '@topcoder-platform/tc-auth-lib'; import { config, isomorphy } from 'topcoder-react-utils'; import { tc } from 'topcoder-react-lib'; From 630e97cf556394673c0f114a51ea0116ae9b0cd7 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Wed, 30 Sep 2020 11:30:34 -0300 Subject: [PATCH 20/35] Change tc-auth-lib name --- __tests__/client/client.jsx | 2 +- __tests__/shared/reducers/auth.js | 2 +- __tests__/shared/reducers/challenge.js | 2 +- src/shared/containers/EmailVerification/index.jsx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/__tests__/client/client.jsx b/__tests__/client/client.jsx index f76a304068..84e6e19b26 100644 --- a/__tests__/client/client.jsx +++ b/__tests__/client/client.jsx @@ -106,7 +106,7 @@ const mockTcAccounts = { decodeToken: () => ({ exp: Date.now() }), getFreshToken: () => Promise.resolve(tokenV3), }; -jest.setMock('tc-auth-lib', mockTcAccounts); +jest.setMock('@topcoder-platform/tc-auth-lib', mockTcAccounts); /* Mock auth actions */ /* diff --git a/__tests__/shared/reducers/auth.js b/__tests__/shared/reducers/auth.js index d6c9f923bc..85ae05645f 100644 --- a/__tests__/shared/reducers/auth.js +++ b/__tests__/shared/reducers/auth.js @@ -24,7 +24,7 @@ const mockActions = { _.merge(actions, mockActions); -jest.setMock('tc-auth-lib', { +jest.setMock('@topcoder-platform/tc-auth-lib', { decodeToken: () => 'User object', isTokenExpired: () => false, }); diff --git a/__tests__/shared/reducers/challenge.js b/__tests__/shared/reducers/challenge.js index a65d45fea6..2d4e112a9d 100644 --- a/__tests__/shared/reducers/challenge.js +++ b/__tests__/shared/reducers/challenge.js @@ -11,7 +11,7 @@ import { mock, actions } from 'topcoder-react-lib'; const { mockAction } = mock; -jest.setMock('tc-auth-lib', { +jest.setMock('@topcoder-platform/tc-auth-lib', { decodeToken: () => 'User object', isTokenExpired: () => false, }); diff --git a/src/shared/containers/EmailVerification/index.jsx b/src/shared/containers/EmailVerification/index.jsx index eee56a96e5..e425db7c5a 100644 --- a/src/shared/containers/EmailVerification/index.jsx +++ b/src/shared/containers/EmailVerification/index.jsx @@ -8,7 +8,7 @@ import PT from 'prop-types'; import {connect} from "react-redux"; import { actions } from "topcoder-react-lib"; import { Redirect } from 'react-router'; -import {isTokenExpired} from "tc-auth-lib"; +import {isTokenExpired} from '@topcoder-platform/tc-auth-lib'; import * as queryString from 'query-string'; import LoadingIndicator from 'components/LoadingIndicator'; import Error404 from 'components/Error404'; From 4a97b205a5d0f59310188591b4fb1b9c5ce935b1 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Thu, 1 Oct 2020 21:28:19 -0300 Subject: [PATCH 21/35] Added @topcoder to babel transform ignore --- bin/www | 2 +- config/jest/default.js | 2 +- config/webpack/development.js | 2 +- config/webpack/production.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/www b/bin/www index 0ed62f7ba6..ef2d8722eb 100644 --- a/bin/www +++ b/bin/www @@ -5,7 +5,7 @@ /* Enables Babel for the server-side code (with exception of this very file). */ require('babel-register')({ ignore: [ - /node_modules\/(?!appirio-tech.*|topcoder|tc-)/, + /node_modules\/(?!appirio-tech.*|topcoder|tc-|@topcoder)/, /node_modules\/topcoder-react-utils/, ], }); diff --git a/config/jest/default.js b/config/jest/default.js index bcf9b8d5af..bc35369eba 100644 --- a/config/jest/default.js +++ b/config/jest/default.js @@ -1,7 +1,7 @@ const config = require('topcoder-react-utils/config/jest/default'); const nodeConfig = require('config'); -config.transformIgnorePatterns[0] = '/node_modules/(?!appirio-tech|topcoder|tc-)'; +config.transformIgnorePatterns[0] = '/node_modules/(?!appirio-tech|topcoder|tc-|@topcoder)'; // Include the directories whose tests has been written to minimize coverage time config.collectCoverageFrom = ['src/client/*.{js,jsx}', 'src/server/*.{js,jsx}', 'src/shared/*.{js,jsx}']; diff --git a/config/webpack/development.js b/config/webpack/development.js index a7b910a4d3..bc853989aa 100644 --- a/config/webpack/development.js +++ b/config/webpack/development.js @@ -17,7 +17,7 @@ const standardDevelopmentConfig = configFactory({ const jsxRule = standardDevelopmentConfig.module.rules.find(rule => rule.loader === 'babel-loader'); jsxRule.exclude = [ - /node_modules[\\/](?!appirio-tech.*|topcoder|tc-)/, + /node_modules[\\/](?!appirio-tech.*|topcoder|tc-|@topcoder)/, /src[\\/]assets[\\/]fonts/, /src[\\/]assets[\\/]images[\\/]dashboard/, ]; diff --git a/config/webpack/production.js b/config/webpack/production.js index 4023147b4d..ab95dbac37 100644 --- a/config/webpack/production.js +++ b/config/webpack/production.js @@ -24,7 +24,7 @@ const standardDevelopmentConfig = configFactory({ const jsxRule = standardDevelopmentConfig.module.rules.find(rule => rule.loader === 'babel-loader'); jsxRule.exclude = [ - /node_modules[\\/](?!appirio-tech.*|topcoder|tc-)/, + /node_modules[\\/](?!appirio-tech.*|topcoder|tc-|@topcoder)/, /src[\\/]assets[\\/]fonts/, /src[\\/]assets[\\/]images[\\/]dashboard/, ]; From c853a0cf00a596c987dd9514341cdcee253d58bf Mon Sep 17 00:00:00 2001 From: Luiz Ricardo Rodrigues Date: Tue, 13 Oct 2020 06:53:24 -0300 Subject: [PATCH 22/35] fix: for issue #4937 Issue: https://github.com/topcoder-platform/community-app/issues/4937 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4304fb6162..e53002d583 100644 --- a/package.json +++ b/package.json @@ -140,7 +140,7 @@ "supertest": "^3.1.0", "tc-core-library-js": "github:appirio-tech/tc-core-library-js#v2.6.3", "tc-ui": "^1.0.12", - "topcoder-react-lib": "1000.24.6", + "topcoder-react-lib": "1000.23.1", "topcoder-react-ui-kit": "2.0.1", "topcoder-react-utils": "0.7.8", "turndown": "^4.0.2", From 862c04449df4824a461a0451417fbd8cde2187a9 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Wed, 14 Oct 2020 03:19:51 -0300 Subject: [PATCH 23/35] Updated footer Join Community link to new Auth0 --- .../shared/components/__snapshots__/TopcoderFooter.jsx.snap | 2 +- src/shared/components/TopcoderFooter/index.jsx | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/__tests__/shared/components/__snapshots__/TopcoderFooter.jsx.snap b/__tests__/shared/components/__snapshots__/TopcoderFooter.jsx.snap index 387a544a65..c7007eef45 100644 --- a/__tests__/shared/components/__snapshots__/TopcoderFooter.jsx.snap +++ b/__tests__/shared/components/__snapshots__/TopcoderFooter.jsx.snap @@ -316,7 +316,7 @@ exports[`Matches shallow shapshot 1`] = ` className="src-shared-components-TopcoderFooter-___style__link___3-nzm" > Join Community diff --git a/src/shared/components/TopcoderFooter/index.jsx b/src/shared/components/TopcoderFooter/index.jsx index 1910102404..587153bd65 100644 --- a/src/shared/components/TopcoderFooter/index.jsx +++ b/src/shared/components/TopcoderFooter/index.jsx @@ -2,7 +2,7 @@ import moment from 'moment'; import PT from 'prop-types'; import React from 'react'; -import { config } from 'topcoder-react-utils'; +import { config, isomorphy } from 'topcoder-react-utils'; import FacebookIcon from './icons/icon-fb.svg'; import YouTubeIcon from './icons/icon-youtube.svg'; @@ -33,6 +33,8 @@ Link.propTypes = { export default function TopcoderFooter() { const base = config.URL.BASE; + const auth = config.URL.AUTH; + const retUrl = isomorphy.isClientSide() ? encodeURIComponent(window.location.href) : ''; const currentYear = moment().year(); return (
@@ -90,7 +92,7 @@ export default function TopcoderFooter() {
    Admins Contact Us - Join Community + Join Community About Community Changelog Talk to Sales From b3612c0f7146a1a38d698065d61539061f011686 Mon Sep 17 00:00:00 2001 From: Sushil Shinde Date: Thu, 15 Oct 2020 19:53:01 +0530 Subject: [PATCH 24/35] ci: deploying on dev env --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c1278ff95d..04ea6facaf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -230,7 +230,7 @@ workflows: filters: branches: only: - - feature/auth0-RS256-Idtoken + - develop-auth0-sync - develop # This is alternate dev env for parallel testing - "build-test": From 9f122b31260e3c91fbf9aeb81ce26055fef4dc71 Mon Sep 17 00:00:00 2001 From: Kiril Kartunov Date: Tue, 20 Oct 2020 12:10:31 +0300 Subject: [PATCH 25/35] ci: on staging --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 04ea6facaf..7341ecdb80 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -260,7 +260,7 @@ workflows: filters: branches: only: - - develop + - develop-auth0-sync # Production builds are exectuted # when PR is merged to the master # Don't change anything in this configuration From b6a17609a89fc17b35284113b5df3ba045cf6a9f Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Wed, 21 Oct 2020 05:32:33 -0300 Subject: [PATCH 26/35] Fix logout to Wipro and TCO19 --- config/default.js | 1 + config/production.js | 1 + src/shared/components/tc-communities/Header/index.jsx | 2 +- src/shared/routes/Communities/TCO19/Routes.jsx | 2 ++ src/shared/routes/Communities/Wipro/Routes.jsx | 2 ++ 5 files changed, 7 insertions(+), 1 deletion(-) diff --git a/config/default.js b/config/default.js index 6127fe6263..011f5c5395 100644 --- a/config/default.js +++ b/config/default.js @@ -142,6 +142,7 @@ module.exports = { STUDIO: 'https://studio.topcoder-dev.com', TCO: 'https://www.topcoder.com/tco', TCO17: 'https://tco17.topcoder.com/', + TCO19: 'https://community-app.topcoder-dev.com/__community__/tco19', TOPGEAR: 'https://dev-topgear.wipro.com', diff --git a/config/production.js b/config/production.js index f8c8e7ccae..bb24579130 100644 --- a/config/production.js +++ b/config/production.js @@ -41,6 +41,7 @@ module.exports = { /* Connector URL of the TC accounts App. */ ACCOUNTS_APP_CONNECTOR: 'https://accounts-auth0.topcoder.com/', TCO17: 'https://tco17.topcoder.com/', + TCO19: 'https://tco19.topcoder.com/', TOPGEAR: 'https://topgear-app.wipro.com', diff --git a/src/shared/components/tc-communities/Header/index.jsx b/src/shared/components/tc-communities/Header/index.jsx index c610f947e6..6c8b6b9fb2 100644 --- a/src/shared/components/tc-communities/Header/index.jsx +++ b/src/shared/components/tc-communities/Header/index.jsx @@ -81,7 +81,7 @@ function Header(props) { icon: , // TODO: In addition to hitting ${AUTH_URL}/logout, which logs out // from the accounts-app, we should wipe out auth cookies! - link: `${AUTH_URL}/logout?retUrl=${logoutRedirect}`, + link: `${AUTH_URL}?logout=true&retUrl=${encodeURIComponent(logoutRedirect)}`, title: 'Log Out', }], }; diff --git a/src/shared/routes/Communities/TCO19/Routes.jsx b/src/shared/routes/Communities/TCO19/Routes.jsx index 612e1f5de0..cff52d9c4b 100644 --- a/src/shared/routes/Communities/TCO19/Routes.jsx +++ b/src/shared/routes/Communities/TCO19/Routes.jsx @@ -15,6 +15,7 @@ import { HeroImageLoader } from 'components/Contentful/BlogPost'; import ContentfulRoute from 'components/Contentful/Route'; import Profile from 'routes/Profile'; import ProfileStats from 'routes/ProfileStats'; +import { config } from 'topcoder-react-utils'; import headerTheme from 'components/tc-communities/communities/tco19/themes/header.scss'; @@ -28,6 +29,7 @@ export default function TCO19({ base, meta }) { baseUrl={base} pageId={match.params.pageId || 'home'} theme={headerTheme} + logoutRedirect={config.URL.TCO19} /> Date: Wed, 21 Oct 2020 15:09:59 -0300 Subject: [PATCH 27/35] Fix challenge status check --- src/shared/containers/challenge-detail/index.jsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/shared/containers/challenge-detail/index.jsx b/src/shared/containers/challenge-detail/index.jsx index 1dc074aee0..c2c1f185f2 100644 --- a/src/shared/containers/challenge-detail/index.jsx +++ b/src/shared/containers/challenge-detail/index.jsx @@ -406,7 +406,7 @@ class ChallengeDetailPageContainer extends React.Component { } - const submissionEnded = status === 'COMPLETED' + const submissionEnded = status === CHALLENGE_STATUS.COMPLETED || (!_.some(phases, { name: 'Submission', isOpen: true }) && !_.some(phases, { name: 'Checkpoint Submission', isOpen: true })); @@ -849,9 +849,7 @@ const mapDispatchToProps = (dispatch) => { dispatch(a.fetchCheckpointsDone(tokens.tokenV2, ch.legacyId)); } else dispatch(a.dropCheckpoints()); } else dispatch(a.dropCheckpoints()); - if (ch.status === 'COMPLETED') { - dispatch(a.loadResultsInit(challengeId)); - dispatch(a.loadResultsDone(tokens, challengeId, ch.track.toLowerCase())); + if (ch.status === CHALLENGE_STATUS.COMPLETED) { } else dispatch(a.dropResults()); return res; }); From de0b0d5a537ea285ffc8dddb8b215f647ed00087 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Wed, 21 Oct 2020 15:10:30 -0300 Subject: [PATCH 28/35] Pass legacyid to v2 results call --- src/shared/containers/challenge-detail/index.jsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/shared/containers/challenge-detail/index.jsx b/src/shared/containers/challenge-detail/index.jsx index c2c1f185f2..3c2efdf568 100644 --- a/src/shared/containers/challenge-detail/index.jsx +++ b/src/shared/containers/challenge-detail/index.jsx @@ -38,6 +38,7 @@ import { COMPETITION_TRACKS, COMPETITION_TRACKS_V3, SUBTRACKS, + CHALLENGE_STATUS, } from 'utils/tc'; import { config, MetaTags } from 'topcoder-react-utils'; import { actions } from 'topcoder-react-lib'; @@ -850,6 +851,8 @@ const mapDispatchToProps = (dispatch) => { } else dispatch(a.dropCheckpoints()); } else dispatch(a.dropCheckpoints()); if (ch.status === CHALLENGE_STATUS.COMPLETED) { + dispatch(a.loadResultsInit(ch.legacyId)); + dispatch(a.loadResultsDone(tokens, ch.legacyId, ch.track.toLowerCase())); } else dispatch(a.dropResults()); return res; }); From a4a78d0d5157c0c191fdd9968d40397fd9db6b17 Mon Sep 17 00:00:00 2001 From: Luiz Ricardo Rodrigues Date: Wed, 21 Oct 2020 15:56:20 -0300 Subject: [PATCH 29/35] fix: for issue #5121 Issue #5121 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2f459e3c1c..7c2fb734d9 100644 --- a/package.json +++ b/package.json @@ -140,7 +140,7 @@ "supertest": "^3.1.0", "tc-core-library-js": "github:appirio-tech/tc-core-library-js#v2.6.3", "tc-ui": "^1.0.12", - "topcoder-react-lib": "1000.23.2", + "topcoder-react-lib": "1000.23.3", "topcoder-react-ui-kit": "2.0.1", "topcoder-react-utils": "0.7.8", "turndown": "^4.0.2", From 311e9134882b96282fb3604a5f73609b36a2728c Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Wed, 21 Oct 2020 23:37:05 -0300 Subject: [PATCH 30/35] Footer - Hide Join Community if user logged in --- src/shared/components/TopcoderFooter/index.jsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/shared/components/TopcoderFooter/index.jsx b/src/shared/components/TopcoderFooter/index.jsx index 587153bd65..5d8226f173 100644 --- a/src/shared/components/TopcoderFooter/index.jsx +++ b/src/shared/components/TopcoderFooter/index.jsx @@ -1,3 +1,4 @@ +import cookies from 'browser-cookies'; import moment from 'moment'; import PT from 'prop-types'; import React from 'react'; @@ -33,9 +34,10 @@ Link.propTypes = { export default function TopcoderFooter() { const base = config.URL.BASE; - const auth = config.URL.AUTH; + const authUrl = config.URL.AUTH; const retUrl = isomorphy.isClientSide() ? encodeURIComponent(window.location.href) : ''; const currentYear = moment().year(); + const loggedIn = cookies.get('tcjwt') !== null; return (
    @@ -92,7 +94,9 @@ export default function TopcoderFooter() {
      Admins Contact Us - Join Community + {!loggedIn + && Join Community + } About Community Changelog Talk to Sales From 3ecec98e0da6aa7a1be6c54e7d7f084f7b07f9ea Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Thu, 22 Oct 2020 01:29:06 -0300 Subject: [PATCH 31/35] Footer - check cookies only in client side. --- src/shared/components/TopcoderFooter/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/components/TopcoderFooter/index.jsx b/src/shared/components/TopcoderFooter/index.jsx index 5d8226f173..7d7b2909cd 100644 --- a/src/shared/components/TopcoderFooter/index.jsx +++ b/src/shared/components/TopcoderFooter/index.jsx @@ -36,8 +36,8 @@ export default function TopcoderFooter() { const base = config.URL.BASE; const authUrl = config.URL.AUTH; const retUrl = isomorphy.isClientSide() ? encodeURIComponent(window.location.href) : ''; + const loggedIn = isomorphy.isClientSide() && cookies.get('tcjwt') !== null; const currentYear = moment().year(); - const loggedIn = cookies.get('tcjwt') !== null; return (
      From c6881a20e3384c9f56cc1bf08522b9b54b60f4ca Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Thu, 22 Oct 2020 11:37:52 -0300 Subject: [PATCH 32/35] Fix Logout retUrl to all sub-communities --- config/default.js | 2 ++ config/production.js | 2 ++ .../components/tc-communities/Header/index.jsx | 16 ++++++++++++++-- .../routes/Communities/Blockchain/Routes.jsx | 1 + src/shared/routes/Communities/CS/Routes.jsx | 2 ++ .../routes/Communities/Cognitive/Routes.jsx | 1 + src/shared/routes/Communities/Comcast/Routes.jsx | 2 ++ 7 files changed, 24 insertions(+), 2 deletions(-) diff --git a/config/default.js b/config/default.js index 011f5c5395..7f4b987e90 100644 --- a/config/default.js +++ b/config/default.js @@ -119,6 +119,8 @@ module.exports = { BLOCKCHAIN: 'https://blockchain.topcoder-dev.com', COGNITIVE: 'https://cognitive.topcoder-dev.com', ZURICH: 'https://community-app.topcoder-dev.com/__community__/zurich', + COMCAST: 'https://community-app.topcoder-dev.com/__community__/comcast', + CS: 'https://community-app.topcoder-dev.com/__community__/cs', }, /* Dedicated section to group together links to various articles in diff --git a/config/production.js b/config/production.js index bb24579130..44f89c1ef9 100644 --- a/config/production.js +++ b/config/production.js @@ -51,6 +51,8 @@ module.exports = { BLOCKCHAIN: 'https://blockchain.topcoder.com', COGNITIVE: 'https://cognitive.topcoder.com', ZURICH: 'https://zurich.topcoder.com', + COMCAST: 'https://comcast.topcoder.com', + CS: 'https://cs.topcoder.com', }, EMAIL_VERIFY_URL: 'http://www.topcoder.com/settings/account/changeEmail', }, diff --git a/src/shared/components/tc-communities/Header/index.jsx b/src/shared/components/tc-communities/Header/index.jsx index 6c8b6b9fb2..4c15cac657 100644 --- a/src/shared/components/tc-communities/Header/index.jsx +++ b/src/shared/components/tc-communities/Header/index.jsx @@ -12,7 +12,12 @@ import DesktopSubMenu from 'components/TopcoderHeader/desktop/SubMenu'; import React from 'react'; import PT from 'prop-types'; import { Avatar, PrimaryButton, Button } from 'topcoder-react-ui-kit'; -import { config, Link, NavLink } from 'topcoder-react-utils'; +import { + config, + Link, + NavLink, + isomorphy, +} from 'topcoder-react-utils'; import { getRatingColor } from 'utils/tc'; import Dropdown from 'components/tc-communities/Dropdown'; import { themr } from 'react-css-super-themr'; @@ -47,10 +52,13 @@ function Header(props) { onMobileToggleClick, profile, theme, - logoutRedirect, meta, } = props; + let { + logoutRedirect, + } = props; + const BASE_URL = config.URL.BASE; const AUTH_URL = config.URL.AUTH; const normalizedProfile = profile && _.clone(profile); @@ -59,6 +67,10 @@ function Header(props) { meta.competitorsGroupIds, ) : []; + if (_.isEmpty(logoutRedirect) && isomorphy.isClientSide()) { + logoutRedirect = window.location.href; + } + let userSubMenu; if (profile) { userSubMenu = { diff --git a/src/shared/routes/Communities/Blockchain/Routes.jsx b/src/shared/routes/Communities/Blockchain/Routes.jsx index bcf49f27bf..6ede568403 100644 --- a/src/shared/routes/Communities/Blockchain/Routes.jsx +++ b/src/shared/routes/Communities/Blockchain/Routes.jsx @@ -57,6 +57,7 @@ export default function Blockchain({ base, member, meta }) { baseUrl={base} hideJoinNow pageId={match.params.pageId || 'home'} + logoutRedirect={config.URL.COMMUNITIES.BLOCKCHAIN} /> Date: Thu, 29 Oct 2020 01:31:31 -0300 Subject: [PATCH 33/35] fix: for issues #4937 and #5121 PR: https://github.com/topcoder-platform/topcoder-react-lib/pull/277 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7c2fb734d9..b848f00cdb 100644 --- a/package.json +++ b/package.json @@ -140,7 +140,7 @@ "supertest": "^3.1.0", "tc-core-library-js": "github:appirio-tech/tc-core-library-js#v2.6.3", "tc-ui": "^1.0.12", - "topcoder-react-lib": "1000.23.3", + "topcoder-react-lib": "1000.23.4", "topcoder-react-ui-kit": "2.0.1", "topcoder-react-utils": "0.7.8", "turndown": "^4.0.2", From 9cf0e621e446eb8e22fc5091d177e8d414e52b42 Mon Sep 17 00:00:00 2001 From: Luiz Ricardo Rodrigues Date: Thu, 29 Oct 2020 01:32:44 -0300 Subject: [PATCH 34/35] ci: deploy develop to Stag env --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7341ecdb80..04ea6facaf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -260,7 +260,7 @@ workflows: filters: branches: only: - - develop-auth0-sync + - develop # Production builds are exectuted # when PR is merged to the master # Don't change anything in this configuration From 763eb714420e9a3db4c6a147fd6da5ce9a2cf5cc Mon Sep 17 00:00:00 2001 From: Sushil Shinde Date: Thu, 29 Oct 2020 17:14:18 +0530 Subject: [PATCH 35/35] release: auth0 changes --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b848f00cdb..113c861e6d 100644 --- a/package.json +++ b/package.json @@ -140,7 +140,7 @@ "supertest": "^3.1.0", "tc-core-library-js": "github:appirio-tech/tc-core-library-js#v2.6.3", "tc-ui": "^1.0.12", - "topcoder-react-lib": "1000.23.4", + "topcoder-react-lib": "1.1.0", "topcoder-react-ui-kit": "2.0.1", "topcoder-react-utils": "0.7.8", "turndown": "^4.0.2",