mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-09 09:51:02 +01:00
remove login from individual subvault
This commit is contained in:
parent
051703234c
commit
0b9083915a
@ -94,4 +94,26 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.removeLogin = function (login, subvault) {
|
||||||
|
if (!confirm('Are you sure you want to remove this login (' + login.name + ') from the ' +
|
||||||
|
'subvault (' + subvault.name + ') ?')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var request = {
|
||||||
|
subvaultIds: []
|
||||||
|
};
|
||||||
|
|
||||||
|
for (var i = 0; i < login.subvaultIds.length; i++) {
|
||||||
|
if (login.subvaultIds[i] !== subvault.id) {
|
||||||
|
request.subvaultIds.push(login.subvaultIds[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apiService.ciphers.putSubvaults({ id: login.id }, request).$promise.then(function (response) {
|
||||||
|
$analytics.eventTrack('Removed From Subvault');
|
||||||
|
login.subvaultIds = request.subvaultIds;
|
||||||
|
});
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="javascript:void(0)" ng-click="deleteLogin(login)" class="text-red"
|
<a href="javascript:void(0)" ng-click="removeLogin(login, subvault)" class="text-red"
|
||||||
ng-if="subvault.id">
|
ng-if="subvault.id">
|
||||||
<i class="fa fa-fw fa-remove"></i> Remove
|
<i class="fa fa-fw fa-remove"></i> Remove
|
||||||
</a>
|
</a>
|
||||||
|
@ -113,6 +113,31 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.removeLogin = function (login, subvault) {
|
||||||
|
if (!confirm('Are you sure you want to remove this login (' + login.name + ') from the ' +
|
||||||
|
'subvault (' + subvault.name + ') ?')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var request = {
|
||||||
|
subvaultIds: []
|
||||||
|
};
|
||||||
|
|
||||||
|
for (var i = 0; i < login.subvaultIds.length; i++) {
|
||||||
|
if (login.subvaultIds[i] !== subvault.id) {
|
||||||
|
request.subvaultIds.push(login.subvaultIds[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apiService.ciphers.putSubvaults({ id: login.id }, request).$promise.then(function (response) {
|
||||||
|
$analytics.eventTrack('Removed From Subvault');
|
||||||
|
login.subvaultIds = request.subvaultIds;
|
||||||
|
if (!login.subvaultIds.length) {
|
||||||
|
removeRootLogin(findRootLogin(login));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
function findRootLogin(login) {
|
function findRootLogin(login) {
|
||||||
if ($rootScope.vaultLogins) {
|
if ($rootScope.vaultLogins) {
|
||||||
var rootLogins = $filter('filter')($rootScope.vaultLogins, { id: login.id });
|
var rootLogins = $filter('filter')($rootScope.vaultLogins, { id: login.id });
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="javascript:void(0)" ng-click="deleteLogin(login)" class="text-red">
|
<a href="javascript:void(0)" ng-click="removeLogin(login, subvault)" class="text-red">
|
||||||
<i class="fa fa-fw fa-remove"></i> Remove
|
<i class="fa fa-fw fa-remove"></i> Remove
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
Loading…
Reference in New Issue
Block a user