From 5c471e43dd06d7ebb6ddb3ca755acc95d02f01f0 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 25 Apr 2017 10:46:54 -0400 Subject: [PATCH] return state for org create on register/login --- src/app/accounts/accountsLoginController.js | 13 ++++++++++++- src/app/accounts/accountsRegisterController.js | 11 ++++++++++- src/app/config.js | 4 ++-- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/app/accounts/accountsLoginController.js b/src/app/accounts/accountsLoginController.js index 480f9a4239..81f93879f7 100644 --- a/src/app/accounts/accountsLoginController.js +++ b/src/app/accounts/accountsLoginController.js @@ -4,7 +4,18 @@ angular .controller('accountsLoginController', function ($scope, $rootScope, $cookies, apiService, cryptoService, authService, $state, constants, $analytics) { $scope.state = $state; - var returnState = $state.params.returnState; + + var returnState; + if (!$state.params.returnState && $state.params.org) { + returnState = { + name: 'backend.user.settingsCreateOrg', + params: { plan: $state.params.org } + }; + } + else { + returnState = $state.params.returnState; + } + var rememberedEmail = $cookies.get(constants.rememberedEmailCookieName); if (rememberedEmail || $state.params.email) { $scope.model = { diff --git a/src/app/accounts/accountsRegisterController.js b/src/app/accounts/accountsRegisterController.js index 6dc06b7d4f..d45399bc6b 100644 --- a/src/app/accounts/accountsRegisterController.js +++ b/src/app/accounts/accountsRegisterController.js @@ -6,7 +6,16 @@ angular var params = $location.search(); var stateParams = $state.params; - $scope.returnState = $state.params.returnState; + if (!stateParams.returnState && stateParams.org) { + $scope.returnState = { + name: 'backend.user.settingsCreateOrg', + params: { plan: $state.params.org } + }; + } + else { + $scope.returnState = stateParams.returnState; + } + $scope.success = false; $scope.model = { email: params.email ? params.email : stateParams.email diff --git a/src/app/config.js b/src/app/config.js index e1cb1a175d..c696535da9 100644 --- a/src/app/config.js +++ b/src/app/config.js @@ -185,7 +185,7 @@ angular } }) .state('frontend.login.info', { - url: '^/', + url: '^/?org', templateUrl: 'app/accounts/views/accountsLoginInfo.html', data: { pageTitle: 'Log In' @@ -225,7 +225,7 @@ angular } }) .state('frontend.register', { - url: '^/register', + url: '^/register?org', templateUrl: 'app/accounts/views/accountsRegister.html', controller: 'accountsRegisterController', params: {