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.$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 });
}
});
}]);

View File

@ -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 () {