1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-24 12:06:15 +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
.module('bit.directives')
.directive('apiForm', function ($rootScope, validationService) {
.directive('apiForm', function ($rootScope, validationService, $timeout) {
return {
require: 'form',
restrict: 'A',
@ -25,12 +25,16 @@ angular
form.$loading = true;
promise.then(function success(response) {
form.$loading = false;
$timeout(function () {
form.$loading = false;
});
}, function failure(reason) {
form.$loading = false;
validationService.addErrors(form, reason);
scope.$broadcast('show-errors-check-validity');
$('html, body').animate({ scrollTop: 0 }, 200);
$timeout(function () {
form.$loading = false;
validationService.addErrors(form, reason);
scope.$broadcast('show-errors-check-validity');
$('html, body').animate({ scrollTop: 0 }, 200);
});
});
}
});

View File

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

View File

@ -200,6 +200,11 @@
};
$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({
animation: true,
templateUrl: 'app/vault/views/vaultAttachments.html',