Show message if an credential is expired

This commit is contained in:
brantje 2016-10-03 23:00:46 +02:00
parent 2b8efe22fa
commit 306bdbda8b
No known key found for this signature in database
GPG key ID: 5FF1D117F918687F
3 changed files with 59 additions and 47 deletions

View file

@ -6,7 +6,7 @@
* Controller of the passmanApp * Controller of the passmanApp
*/ */
angular.module('passmanApp') angular.module('passmanApp')
.controller('PublicSharedCredential', ['$scope', 'ShareService', function ($scope, ShareService) { .controller('PublicSharedCredential', ['$scope', 'ShareService','$window', function ($scope, ShareService, $window) {
$scope.test = 'hello world'; $scope.test = 'hello world';
$scope.loading = false; $scope.loading = false;
@ -75,12 +75,18 @@ angular.module('passmanApp')
$scope.loadSharedCredential = function () { $scope.loadSharedCredential = function () {
$scope.loading = true; $scope.loading = true;
ShareService.getPublicSharedCredential().then(function (sharedCredential) { var guid = $window.location.hash.replace('#','');
//Decrypt stuff here ShareService.getPublicSharedCredential(guid).then(function (sharedCredential) {
//And then set it
$scope.loading = false; $scope.loading = false;
console.log(sharedCredential)
if(sharedCredential.status === 200){
$scope.shared_credential = example_shared_credential; $scope.shared_credential = example_shared_credential;
} else {
$scope.expired = true;
}
}, function(error){
return false;
}) })
} }

View file

@ -77,11 +77,14 @@ angular.module('passmanApp')
var queryUrl = OC.generateUrl('apps/passman/api/v2/sharing/credential/' + credential_guid); var queryUrl = OC.generateUrl('apps/passman/api/v2/sharing/credential/' + credential_guid);
return $http.get(queryUrl).then(function (response) { return $http.get(queryUrl).then(function (response) {
if (response.data) { if (response.data) {
return response.data; return response;
} else { } else {
return response; return response;
} }
}); },
function (result) {
return result;
})
}, },
getCredendialsSharedWithUs: function (vault_guid) { getCredendialsSharedWithUs: function (vault_guid) {
var queryUrl = OC.generateUrl('apps/passman/api/v2/sharing/vault/' + vault_guid + '/get'); var queryUrl = OC.generateUrl('apps/passman/api/v2/sharing/vault/' + vault_guid + '/get');

View file

@ -64,7 +64,7 @@ style('passman', 'public-page');
<div class="row"> <div class="row">
<div class="col-xs-8 col-xs-push-2 col-xs-pull-2 credential_container"> <div class="col-xs-8 col-xs-push-2 col-xs-pull-2 credential_container">
<h2>Passman</h2> <h2>Passman</h2>
<div ng-if="!shared_credential"> <div ng-if="!shared_credential && !expired">
<span class="text">{name} has shared a credential with you.</span> <span class="text">{name} has shared a credential with you.</span>
<button class="button-geen" ng-if="!loading" <button class="button-geen" ng-if="!loading"
ng-click="loadSharedCredential()">Click here to request ng-click="loadSharedCredential()">Click here to request
@ -74,6 +74,9 @@ style('passman', 'public-page');
class="fa fa-spinner fa-spin"></i>Loading... class="fa fa-spinner fa-spin"></i>Loading...
</button> </button>
</div> </div>
<div ng-if="expired">
Awwhh.... this credential is expired :(.
</div>
<div ng-if="shared_credential"> <div ng-if="shared_credential">
<table class="table"> <table class="table">
<tr ng-show="shared_credential.label"> <tr ng-show="shared_credential.label">