From d7340c57a499d6b60599b1190ea801d9a1f5c807 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Wed, 30 Mar 2016 10:37:13 +0200 Subject: [PATCH] next url support in login view if the user is logged in --- app/coffee/modules/auth.coffee | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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)