diff --git a/app/coffee/modules/auth.coffee b/app/coffee/modules/auth.coffee index 31f73349..5267c509 100644 --- a/app/coffee/modules/auth.coffee +++ b/app/coffee/modules/auth.coffee @@ -31,12 +31,19 @@ class LoginPage @.$inject = [ 'tgCurrentUserService', '$location', - '$tgNavUrls' + '$tgNavUrls', + '$routeParams' ] - constructor: (currentUserService, $location, $navUrls) -> + constructor: (currentUserService, $location, $navUrls, $routeParams) -> if currentUserService.isAuthenticated() - $location.path($navUrls.resolve("home")) + url = $navUrls.resolve("home") + if $routeParams['next'] + url = $routeParams['next'] + $location.search('next', null) + + $location.path(url) + module.controller('LoginPage', LoginPage)