From b897d8275a4b39f345f5962ce0f1b22c1e45d237 Mon Sep 17 00:00:00 2001 From: Jon Lambson Date: Wed, 1 Nov 2017 12:10:39 -0600 Subject: [PATCH] fixing url params when already accepted invite --- js/app.js | 7 ++----- js/controllers/website-controller.js | 22 ++++++++-------------- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/js/app.js b/js/app.js index 0a56fd6..666dc8e 100644 --- a/js/app.js +++ b/js/app.js @@ -158,8 +158,6 @@ app.run(['$rootScope', '$state', 'Auth', '$location', function($rootScope, $stat $rootScope.urlCrumbs = []; $rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) { var requiresLogin = toState.data.requiresLogin; - toState.data.session = $location.search(); - var query = $location.search(); var Crumbs = new Object(); Crumbs = { absUrl: $location.$$absUrl, @@ -171,9 +169,8 @@ app.run(['$rootScope', '$state', 'Auth', '$location', function($rootScope, $stat }; $rootScope.urlCrumbs.push(Crumbs); if (requiresLogin && !Auth.isLoggedIn()) { - if (!angular.equals(toState.data.session, {})) { - $state.go('splash-page', { 'toState': toState.name }); - } + event.preventDefault(); + $state.go('splash-page', { 'toState': toState.name }); } }); }]); diff --git a/js/controllers/website-controller.js b/js/controllers/website-controller.js index 927512f..95e15ce 100644 --- a/js/controllers/website-controller.js +++ b/js/controllers/website-controller.js @@ -66,8 +66,8 @@ app.directive('notificationBar', [function () { }]); app.controller('websiteCtrl', [ - '$scope', '$q', 'Auth', 'azp@oauth3.org', '$timeout', '$sce', '$rootScope', - function ($scope, $q, Auth, Oauth3, $timeout, $sce, $rootScope) { + '$scope', '$q', 'Auth', 'azp@oauth3.org', '$timeout', '$sce', '$rootScope', '$location', + function ($scope, $q, Auth, Oauth3, $timeout, $sce, $rootScope, $location) { var vm = this; var angular = window.angular; @@ -618,11 +618,9 @@ app.controller('websiteCtrl', [ token: vm.Shares.inviteToken }).then(function (result) { if (result.data.error) { - debugger; var msg = result.data.error.message + '.'; vm.buildNotification(result, msg); } else { - debugger; var person = result.data.comment; var path = result.data.path; var shareMode = result.data.mode; @@ -631,8 +629,12 @@ app.controller('websiteCtrl', [ vm.buildNotification(result, msg); vm.listSites(); } + if ($location.$$search.token) { + delete $location.$$search.token; + vm.Shares.inviteToken = ''; + $location.$$compose(); + } }); - }; vm.Shares.list = function (r) { @@ -868,15 +870,7 @@ app.controller('websiteCtrl', [ message: msg }; } - //Hide notification - $timeout(function() { - vm.alertNotification = { - className: '', - title: '', - hidden: 'hidden', - message: '' - }; - }, 7000); + window.scrollTo(0, 0); }; vm.closeAllOpenActions = function () {