Get team invite confirmation working and fully tested

This commit is contained in:
Joseph Schorr 2014-08-18 17:24:00 -04:00
parent eefb7e1ec9
commit 43b6695f9c
12 changed files with 458 additions and 43 deletions

View file

@ -20,6 +20,17 @@ $.fn.clipboardCopy = function() {
});
};
function SignInCtrl($scope, $location) {
var redirect = $location.search()['redirect'];
if (redirect && redirect.indexOf('/') < 0) {
delete $location.search()['redirect'];
$scope.redirectUrl = '/' + redirect;
return;
}
$scope.redirectUrl = '/';
}
function GuideCtrl() {
}
@ -2855,3 +2866,28 @@ function SuperUserAdminCtrl($scope, ApiService, Features, UserService) {
function TourCtrl($scope, $location) {
$scope.kind = $location.path().substring('/tour/'.length);
}
function ConfirmInviteCtrl($scope, $location, UserService, ApiService, NotificationService) {
// Monitor any user changes and place the current user into the scope.
$scope.loading = false;
UserService.updateUserIn($scope, function(user) {
if (!user.anonymous && !$scope.loading) {
$scope.loading = true;
var params = {
'code': $location.search()['code']
};
ApiService.acceptOrganizationTeamInvite(null, params).then(function(resp) {
NotificationService.update();
$location.path('/organization/' + resp.org + '/teams/' + resp.team);
}, function() {
$scope.loading = false;
$scope.invalid = true;
});
}
});
$scope.redirectUrl = 'confirminvite?code=' + $location.search()['code'];
}