1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-21 10:43:35 +00:00

share login modal

This commit is contained in:
Kyle Spearrin
2017-02-28 00:18:11 -05:00
parent 63c136a1ff
commit 1ed86899bb
8 changed files with 190 additions and 80 deletions

View File

@@ -0,0 +1,33 @@
angular
.module('bit.vault')
.controller('vaultShareLoginController', function ($scope, apiService, $uibModalInstance, cryptoService, cipherService,
id, $analytics) {
$analytics.eventTrack('vaultShareLoginController', { category: 'Modal' });
apiService.logins.get({
id: id
}, function (login) {
$scope.login = cipherService.decryptLogin(login);
});
$scope.enablePromise = null;
$scope.enable = function () {
var shareKey = cryptoService.makeShareKey();
var encLogin = cipherService.encryptLogin($scope.login, shareKey);
encLogin.key = cryptoService.rsaEncrypt(shareKey);
$scope.enablePromise = apiService.logins.put({ id: $scope.login.id }, encLogin, function (login) {
$scope.login = cipherService.decryptLogin(login);
}).$promise;
};
$scope.sharePromise = null;
$scope.share = function () {
$uibModalInstance.close({});
};
$scope.close = function () {
$uibModalInstance.dismiss('cancel');
};
});