From 9a29e8ed82e61b379433ed7091db66b0303a3550 Mon Sep 17 00:00:00 2001 From: brantje Date: Mon, 30 Oct 2017 18:22:10 +0100 Subject: [PATCH] Fix disabled edit save button after 2 different password entered. Fixes #370 --- js/app/controllers/edit_credential.js | 22 +++++++++++++--------- js/templates.js | 2 +- templates/views/edit_credential.html | 2 +- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/js/app/controllers/edit_credential.js b/js/app/controllers/edit_credential.js index 35f4dd5a..5c9ad4f0 100644 --- a/js/app/controllers/edit_credential.js +++ b/js/app/controllers/edit_credential.js @@ -186,13 +186,12 @@ }; $scope.addFileToCustomField = function (file) { - var _file = { - filename: file.name, - size: file.size, - mimetype: file.type, - data: file.data - }; - $scope.new_custom_field.value = _file; + $scope.new_custom_field.value = { + filename: file.name, + size: file.size, + mimetype: file.type, + data: file.data + }; $scope.$digest(); }; @@ -291,8 +290,9 @@ }; $scope.$digest(); }; - + $scope.saving = false; $scope.saveCredential = function () { + $scope.saving = true; if ($scope.new_custom_field.label && $scope.new_custom_field.value) { @@ -301,7 +301,8 @@ if ($scope.storedCredential.password !== $scope.storedCredential.password_repeat){ - NotificationService.showNotification($translate.instant('password.do.not.match'), 5000); + $scope.saving = false; + NotificationService.showNotification($translate.instant('password.do.not.match'), 5000); return; } @@ -312,8 +313,10 @@ if (!$scope.storedCredential.credential_id) { $scope.storedCredential.vault_id = $scope.active_vault.vault_id; CredentialService.createCredential($scope.storedCredential).then(function () { + $scope.saving = false; $location.path('/vault/' + $routeParams.vault_id); NotificationService.showNotification($translate.instant('credential.created'), 5000); + }); } else { @@ -342,6 +345,7 @@ _credential.description = _credential.description.replace(regex, ""); } CredentialService.updateCredential(_credential, _useKey).then(function () { + $scope.saving = false; SettingsService.setSetting('edit_credential', null); $location.path('/vault/' + $routeParams.vault_id); NotificationService.showNotification($translate.instant('credential.updated'), 5000); diff --git a/js/templates.js b/js/templates.js index 9c25c4f1..fe20bdc9 100644 --- a/js/templates.js +++ b/js/templates.js @@ -9,7 +9,7 @@ angular.module('views/credential_revisions.html', []).run(['$templateCache', fun angular.module('views/edit_credential.html', []).run(['$templateCache', function ($templateCache) { 'use strict'; $templateCache.put('views/edit_credential.html', - '
'); + '
'); }]); angular.module('views/partials/credential_template.html', []).run(['$templateCache', function ($templateCache) { diff --git a/templates/views/edit_credential.html b/templates/views/edit_credential.html index 1c413fec..4d653ec6 100644 --- a/templates/views/edit_credential.html +++ b/templates/views/edit_credential.html @@ -26,6 +26,6 @@
- +