diff --git a/js/app/controllers/share.js b/js/app/controllers/share.js index 8d37aaf3..1915b3ff 100644 --- a/js/app/controllers/share.js +++ b/js/app/controllers/share.js @@ -134,7 +134,7 @@ }; if (enc_key) { var hash = window.btoa($scope.storedCredential.guid + '<::>' + enc_key); - $scope.share_link = $location.$$protocol + '://' + $location.$$host + OC.generateUrl('apps/passman/share/public#') + hash; + $scope.share_link = getShareLink(hash); } } else { var obj = { @@ -271,6 +271,13 @@ } }); + var getShareLink = function(hash){ + var port; + var defaultPort = ($location.$$protocol === 'http') ? 80 : 443; + port = (defaultPort !== $location.$$port) ? ':'+ $location.$$port : ''; + return $location.$$protocol + '://' + $location.$$host + port + OC.generateUrl('apps/passman/share/public#') + hash; + }; + $scope.sharing_complete = true; $scope.applyShare = function () { $scope.sharing_complete = false; @@ -295,7 +302,7 @@ }; ShareService.createPublicSharedCredential(shareObj).then(function () { var hash = window.btoa($scope.storedCredential.guid + '<::>' + enc_key); - $scope.share_link = $location.$$protocol + '://' + $location.$$host + OC.generateUrl('apps/passman/share/public#') + hash; + $scope.share_link = getShareLink(hash); }); } @@ -353,8 +360,7 @@ }; ShareService.createPublicSharedCredential(shareObj).then(function () { var hash = window.btoa($scope.storedCredential.guid + '<::>' + key); - $scope.share_link = $location.$$protocol + '://' + $location.$$host + OC.generateUrl('apps/passman/share/public#') + hash; - + $scope.share_link = getShareLink(hash); }); } @@ -382,4 +388,4 @@ return total; }; }]); -}()); \ No newline at end of file +}());