prevent infinite loop with an invalid token
parent
d19c431f16
commit
d6c26087d8
|
@ -529,7 +529,10 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $tgEven
|
||||||
.search("force_next", search.force_next)
|
.search("force_next", search.force_next)
|
||||||
else
|
else
|
||||||
$location.url($navUrls.resolve("login"))
|
$location.url($navUrls.resolve("login"))
|
||||||
.search("next", nextUrl)
|
.search({
|
||||||
|
"unauthorized": true
|
||||||
|
"next": nextUrl
|
||||||
|
})
|
||||||
|
|
||||||
return $q.reject(response)
|
return $q.reject(response)
|
||||||
|
|
||||||
|
|
|
@ -32,10 +32,11 @@ class LoginPage
|
||||||
'tgCurrentUserService',
|
'tgCurrentUserService',
|
||||||
'$location',
|
'$location',
|
||||||
'$tgNavUrls',
|
'$tgNavUrls',
|
||||||
'$routeParams'
|
'$routeParams',
|
||||||
|
'$tgAuth'
|
||||||
]
|
]
|
||||||
|
|
||||||
constructor: (currentUserService, $location, $navUrls, $routeParams) ->
|
constructor: (currentUserService, $location, $navUrls, $routeParams, $auth) ->
|
||||||
if currentUserService.isAuthenticated()
|
if currentUserService.isAuthenticated()
|
||||||
if not $routeParams['force_login']
|
if not $routeParams['force_login']
|
||||||
url = $navUrls.resolve("home")
|
url = $navUrls.resolve("home")
|
||||||
|
@ -43,7 +44,11 @@ class LoginPage
|
||||||
url = decodeURIComponent($routeParams['next'])
|
url = decodeURIComponent($routeParams['next'])
|
||||||
$location.search('next', null)
|
$location.search('next', null)
|
||||||
|
|
||||||
$location.url(url)
|
if $routeParams['unauthorized']
|
||||||
|
$auth.clear()
|
||||||
|
$auth.removeToken()
|
||||||
|
else
|
||||||
|
$location.url(url)
|
||||||
|
|
||||||
|
|
||||||
module.controller('LoginPage', LoginPage)
|
module.controller('LoginPage', LoginPage)
|
||||||
|
|
Loading…
Reference in New Issue