1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-28 12:45:45 +01:00

attachment errors

This commit is contained in:
Kyle Spearrin 2017-07-05 16:27:28 -04:00
parent b24f892f60
commit 1fb220c25e
3 changed files with 18 additions and 8 deletions

View File

@ -1,7 +1,7 @@
angular angular
.module('bit.directives') .module('bit.directives')
.directive('apiForm', function ($rootScope, validationService) { .directive('apiForm', function ($rootScope, validationService, $timeout) {
return { return {
require: 'form', require: 'form',
restrict: 'A', restrict: 'A',
@ -25,12 +25,16 @@ angular
form.$loading = true; form.$loading = true;
promise.then(function success(response) { promise.then(function success(response) {
$timeout(function () {
form.$loading = false; form.$loading = false;
});
}, function failure(reason) { }, function failure(reason) {
$timeout(function () {
form.$loading = false; form.$loading = false;
validationService.addErrors(form, reason); validationService.addErrors(form, reason);
scope.$broadcast('show-errors-check-validity'); scope.$broadcast('show-errors-check-validity');
$('html, body').animate({ scrollTop: 0 }, 200); $('html, body').animate({ scrollTop: 0 }, 200);
}); });
});
} }
}); });

View File

@ -2,7 +2,7 @@
.module('bit.vault') .module('bit.vault')
.controller('vaultAttachmentsController', function ($scope, apiService, $uibModalInstance, cryptoService, cipherService, .controller('vaultAttachmentsController', function ($scope, apiService, $uibModalInstance, cryptoService, cipherService,
loginId, $analytics, validationService) { loginId, $analytics, validationService, toastr) {
$analytics.eventTrack('vaultAttachmentsController', { category: 'Modal' }); $analytics.eventTrack('vaultAttachmentsController', { category: 'Modal' });
$scope.login = {}; $scope.login = {};
$scope.readOnly = false; $scope.readOnly = false;
@ -45,6 +45,7 @@
return apiService.ciphers.postAttachment({ id: loginId }, fd).$promise; return apiService.ciphers.postAttachment({ id: loginId }, fd).$promise;
}).then(function (response) { }).then(function (response) {
$analytics.eventTrack('Added Attachment'); $analytics.eventTrack('Added Attachment');
toastr.success('The attachment has been added.');
$uibModalInstance.close({ $uibModalInstance.close({
action: 'attach', action: 'attach',
data: $scope.login data: $scope.login

View File

@ -200,6 +200,11 @@
}; };
$scope.attachments = function (login) { $scope.attachments = function (login) {
if (!cryptoService.getEncKey()) {
toastr.error('You cannot use this feature until you update your encryption key.', 'Feature Unavailable');
return;
}
var addModel = $uibModal.open({ var addModel = $uibModal.open({
animation: true, animation: true,
templateUrl: 'app/vault/views/vaultAttachments.html', templateUrl: 'app/vault/views/vaultAttachments.html',