Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 9e26107

Browse files
author
vikasrohit
committed
AS#100297043256582, Move all login to link of Members to accounts.topcoder.com
-- Misc fixes to get it working for pages which don't require auth
1 parent 5ada072 commit 9e26107

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

app/services/authv3.module.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ require('angular-jwt')
55
import { getFreshToken, configureConnector } from 'tc-accounts'
66

77
configureConnector({
8-
connectorUrl: process.env.CONNECTOR_URL,
8+
connectorUrl: process.env.ACCOUNTS_APP_CONNECTOR_URL,
99
frameId: 'tc-accounts-iframe'
1010
})
1111

app/topcoder.module.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ import { getCurrentUser, loadUser } from './services/userv3.service.js'
5050
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
5151
logger.debug('checking auth for state: ' + toState.name + ' from state: ' + fromState.name)
5252
var currentUser = getCurrentUser()
53-
if (!currentUser && toState.data && toState.data.authRequired) {
53+
if (!currentUser) {
5454
event.preventDefault()
5555
loadUser().then(function(token) {
5656
logger.debug('successful login with token ' + JSON.stringify(token))
@@ -59,12 +59,14 @@ import { getCurrentUser, loadUser } from './services/userv3.service.js'
5959
$state.go(toState.name, toParams, {notify: false})
6060
$urlRouter.sync()
6161
}, function() {
62-
logger.debug('State requires authentication, and user is not logged in, redirecting')
63-
// setup redirect for post login
64-
event.preventDefault()
65-
var next = $state.href(toState.name, toParams, {absolute: true})
66-
var retUrl = next
67-
$window.location = CONSTANTS.ACCOUNTS_APP_URL + '?retUrl=' + encodeURIComponent(retUrl)
62+
if (toState.data && toState.data.authRequired) {
63+
logger.debug('State requires authentication, and user is not logged in, redirecting')
64+
// setup redirect for post login
65+
event.preventDefault()
66+
var next = $state.href(toState.name, toParams, {absolute: true})
67+
var retUrl = next
68+
$window.location = CONSTANTS.ACCOUNTS_APP_URL + '?retUrl=' + encodeURIComponent(retUrl)
69+
}
6870
})
6971
}
7072
})

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"devDependencies": {
1111
"angular-mocks": "^1.4.9",
12-
"appirio-tech-webpack-config": "^0.2.0",
12+
"appirio-tech-webpack-config": "^0.3.0",
1313
"babel-polyfill": "^6.7.2",
1414
"bardjs": "^0.1.8",
1515
"bower": "^1.6.8",

0 commit comments

Comments
 (0)