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

Commit 6e192cb

Browse files
author
vikasrohit
committed
AS#100297043256582, Move all login to link of Members to accounts.topcoder.com
-- Fixing lint errors
1 parent 9d6c15c commit 6e192cb

File tree

8 files changed

+22
-23
lines changed

8 files changed

+22
-23
lines changed

app/account/account.routes.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ import angular from 'angular'
1717
},
1818
onEnter: ['$state', '$location', '$stateParams', 'TcAuthService', 'logger',
1919
function($state, $location, $stateParams, TcAuthService, logger) {
20-
logger.debug('Checking for authentication...')
21-
if (TcAuthService.isAuthenticated()) {
22-
// redirect to next if exists else dashboard
23-
if ($stateParams.next) {
24-
logger.debug('Redirecting: ' + $stateParams.next)
25-
window.location.href = decodeURIComponent($stateParams.next)
26-
} else {
27-
$state.go('dashboard')
20+
logger.debug('Checking for authentication...')
21+
if (TcAuthService.isAuthenticated()) {
22+
// redirect to next if exists else dashboard
23+
if ($stateParams.next) {
24+
logger.debug('Redirecting: ' + $stateParams.next)
25+
window.location.href = decodeURIComponent($stateParams.next)
26+
} else {
27+
$state.go('dashboard')
28+
}
2829
}
29-
}
30-
}]
30+
}]
3131
},
3232
'login': {
3333
parent: 'auth',

app/account/logout/logout.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import angular from 'angular'
99

1010
function LogoutController(logger, TcAuthService, $window, CONSTANTS) {
1111
TcAuthService.logout().then(() => {
12-
logger.debug("MAIN_URL=> " + CONSTANTS.MAIN_URL)
12+
logger.debug('MAIN_URL=> ' + CONSTANTS.MAIN_URL)
1313
$window.location.href = CONSTANTS.MAIN_URL
1414
})
1515
}

app/services/authtoken.service.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import angular from 'angular'
1212
var v2TCSSOTokenKey = 'tcsso'
1313
var v3TokenKey = 'appiriojwt'
1414
// use this api url over CONSTANTS
15-
var apiUrl = CONSTANTS.AUTH_API_URL || CONSTANTS.API_URL
15+
// var apiUrl = CONSTANTS.AUTH_API_URL || CONSTANTS.API_URL
1616

1717
var service = {
1818
getV2Token: getV2Token,

app/services/authv3.module.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict'
22

3+
import angular from 'angular'
34
require('angular-jwt')
4-
55
import { getFreshToken } from 'tc-accounts'
66

77
const dependencies = ['angular-jwt']

app/services/jwtInterceptor.service.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { isTokenExpired, getFreshToken } from 'tc-accounts'
1515
}
1616
////////////
1717

18-
function _checkAndRefreshToken(token) {
18+
function _checkAndRefreshToken(config, token) {
1919
if (isTokenExpired(token)) {
2020
logger.debug(String.supplant('Token has expired, attempting to refreshToken() for "{url}"', config))
2121

@@ -26,7 +26,7 @@ import { isTokenExpired, getFreshToken } from 'tc-accounts'
2626
.catch(function(err) {
2727
// Server will not or cannot refresh token
2828
logger.debug('Unable to refresh V3 token, redirecting to login')
29-
logger.debug(resp)
29+
// logger.debug(resp)
3030
var retUrl = CONSTANTS.MAIN_URL + '/?next=' + config.url
3131
$window.location = CONSTANTS.ACCOUNTS_APP_URL + '?retUrl=' + encodeURIComponent(retUrl)
3232

@@ -64,7 +64,7 @@ import { isTokenExpired, getFreshToken } from 'tc-accounts'
6464
} else {
6565
token = getCurrentUser().token
6666
}
67-
_checkAndRefreshToken(token)
67+
_checkAndRefreshToken(config, token)
6868
}
6969
// else
7070
logger.debug(String.supplant('Skipping authToken for "{url}, UnAuthenticated user"', config))
@@ -82,7 +82,7 @@ import { isTokenExpired, getFreshToken } from 'tc-accounts'
8282
}
8383

8484
// Note only v3tokens expire
85-
_checkAndRefreshToken(idToken)
85+
_checkAndRefreshToken(config, idToken)
8686
}
8787
return service
8888
}

app/services/tcAuth.service.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import angular from 'angular'
2-
import { getCurrentUser, loadUser, logout as doLogout } from './userv3.service.js'
2+
import { getCurrentUser, logout as doLogout } from './userv3.service.js'
33

44
(function() {
55
'use strict'

app/services/user.service.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import angular from 'angular'
22
import _ from 'lodash'
33
import { getCurrentUser } from '../services/userv3.service.js'
4-
import { decodeToken, getFreshToken, logout as doLogout } from 'tc-accounts'
4+
import { decodeToken } from 'tc-accounts'
55

66
(function() {
77
'use strict'

app/services/userv3.service.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
'use strict'
22

3+
import angular from 'angular'
34
require('./authv3.module.js')
45

5-
import includes from 'lodash/includes'
6-
import merge from 'lodash/merge'
6+
// import includes from 'lodash/includes'
7+
// import merge from 'lodash/merge'
78
// TODO: Move registration to accounts.topcoder.com
89
import { registerUser} from 'tc-accounts/core/auth.js'
910
import { decodeToken, getFreshToken, logout as doLogout } from 'tc-accounts'
@@ -12,7 +13,6 @@ let currentUser = null
1213

1314
export function loadUser() {
1415
function loadUserSuccess(token) {
15-
console.log(token)
1616
const decodedToken = decodeToken( token )
1717

1818
if (decodedToken.userId) {
@@ -23,7 +23,6 @@ export function loadUser() {
2323

2424
return currentUser
2525
}
26-
console.log('getting fresh token')
2726

2827
return getFreshToken().then(loadUserSuccess)
2928
}

0 commit comments

Comments
 (0)