fixing url params when already accepted invite

This commit is contained in:
Jon Lambson 2017-11-01 12:10:39 -06:00
parent e9d0ce0846
commit b897d8275a
2 changed files with 10 additions and 19 deletions

View File

@ -158,8 +158,6 @@ app.run(['$rootScope', '$state', 'Auth', '$location', function($rootScope, $stat
$rootScope.urlCrumbs = []; $rootScope.urlCrumbs = [];
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) { $rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
var requiresLogin = toState.data.requiresLogin; var requiresLogin = toState.data.requiresLogin;
toState.data.session = $location.search();
var query = $location.search();
var Crumbs = new Object(); var Crumbs = new Object();
Crumbs = { Crumbs = {
absUrl: $location.$$absUrl, absUrl: $location.$$absUrl,
@ -171,10 +169,9 @@ app.run(['$rootScope', '$state', 'Auth', '$location', function($rootScope, $stat
}; };
$rootScope.urlCrumbs.push(Crumbs); $rootScope.urlCrumbs.push(Crumbs);
if (requiresLogin && !Auth.isLoggedIn()) { if (requiresLogin && !Auth.isLoggedIn()) {
if (!angular.equals(toState.data.session, {})) { event.preventDefault();
$state.go('splash-page', { 'toState': toState.name }); $state.go('splash-page', { 'toState': toState.name });
} }
}
}); });
}]); }]);
}()); }());

View File

@ -66,8 +66,8 @@ app.directive('notificationBar', [function () {
}]); }]);
app.controller('websiteCtrl', [ app.controller('websiteCtrl', [
'$scope', '$q', 'Auth', 'azp@oauth3.org', '$timeout', '$sce', '$rootScope', '$scope', '$q', 'Auth', 'azp@oauth3.org', '$timeout', '$sce', '$rootScope', '$location',
function ($scope, $q, Auth, Oauth3, $timeout, $sce, $rootScope) { function ($scope, $q, Auth, Oauth3, $timeout, $sce, $rootScope, $location) {
var vm = this; var vm = this;
var angular = window.angular; var angular = window.angular;
@ -618,11 +618,9 @@ app.controller('websiteCtrl', [
token: vm.Shares.inviteToken token: vm.Shares.inviteToken
}).then(function (result) { }).then(function (result) {
if (result.data.error) { if (result.data.error) {
debugger;
var msg = result.data.error.message + '.'; var msg = result.data.error.message + '.';
vm.buildNotification(result, msg); vm.buildNotification(result, msg);
} else { } else {
debugger;
var person = result.data.comment; var person = result.data.comment;
var path = result.data.path; var path = result.data.path;
var shareMode = result.data.mode; var shareMode = result.data.mode;
@ -631,8 +629,12 @@ app.controller('websiteCtrl', [
vm.buildNotification(result, msg); vm.buildNotification(result, msg);
vm.listSites(); vm.listSites();
} }
if ($location.$$search.token) {
delete $location.$$search.token;
vm.Shares.inviteToken = '';
$location.$$compose();
}
}); });
}; };
vm.Shares.list = function (r) { vm.Shares.list = function (r) {
@ -868,15 +870,7 @@ app.controller('websiteCtrl', [
message: msg message: msg
}; };
} }
//Hide notification window.scrollTo(0, 0);
$timeout(function() {
vm.alertNotification = {
className: '',
title: '',
hidden: 'hidden',
message: ''
};
}, 7000);
}; };
vm.closeAllOpenActions = function () { vm.closeAllOpenActions = function () {