force next url register form
parent
389f27880c
commit
a09e1a7649
|
@ -315,7 +315,7 @@ module.directive("tgLogin", ["$tgAuth", "$tgConfirm", "$tgLocation", "$tgConfig"
|
||||||
## Register Directive
|
## Register Directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
RegisterDirective = ($auth, $confirm, $location, $navUrls, $config, $routeParams, $analytics, $translate) ->
|
RegisterDirective = ($auth, $confirm, $location, $navUrls, $config, $routeParams, $analytics, $translate, $window) ->
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs) ->
|
||||||
if not $config.get("publicRegisterEnabled")
|
if not $config.get("publicRegisterEnabled")
|
||||||
$location.path($navUrls.resolve("not-found"))
|
$location.path($navUrls.resolve("not-found"))
|
||||||
|
@ -324,12 +324,20 @@ RegisterDirective = ($auth, $confirm, $location, $navUrls, $config, $routeParams
|
||||||
$scope.data = {}
|
$scope.data = {}
|
||||||
form = $el.find("form").checksley({onlyOneErrorElement: true})
|
form = $el.find("form").checksley({onlyOneErrorElement: true})
|
||||||
|
|
||||||
$scope.nextUrl = $navUrls.resolve("home")
|
console.log $routeParams['forceNext']
|
||||||
|
|
||||||
|
if $routeParams['forceNext'] and $routeParams['forceNext'] != $navUrls.resolve("register")
|
||||||
|
$scope.nextUrl = decodeURIComponent($routeParams['forceNext'])
|
||||||
|
else
|
||||||
|
$scope.nextUrl = $navUrls.resolve("home")
|
||||||
|
|
||||||
onSuccessSubmit = (response) ->
|
onSuccessSubmit = (response) ->
|
||||||
$analytics.trackEvent("auth", "register", "user registration", 1)
|
$analytics.trackEvent("auth", "register", "user registration", 1)
|
||||||
|
|
||||||
$location.url($scope.nextUrl)
|
if $scope.nextUrl.indexOf('http') == 0
|
||||||
|
$window.location.href = $scope.nextUrl
|
||||||
|
else
|
||||||
|
$location.url($scope.nextUrl)
|
||||||
|
|
||||||
onErrorSubmit = (response) ->
|
onErrorSubmit = (response) ->
|
||||||
if response.data._error_message
|
if response.data._error_message
|
||||||
|
@ -357,7 +365,7 @@ RegisterDirective = ($auth, $confirm, $location, $navUrls, $config, $routeParams
|
||||||
return {link:link}
|
return {link:link}
|
||||||
|
|
||||||
module.directive("tgRegister", ["$tgAuth", "$tgConfirm", "$tgLocation", "$tgNavUrls", "$tgConfig",
|
module.directive("tgRegister", ["$tgAuth", "$tgConfirm", "$tgLocation", "$tgNavUrls", "$tgConfig",
|
||||||
"$routeParams", "$tgAnalytics", "$translate", RegisterDirective])
|
"$routeParams", "$tgAnalytics", "$translate", "$window", RegisterDirective])
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
Loading…
Reference in New Issue