Fix disabled edit save button after 2 different password entered. Fixes #370

This commit is contained in:
brantje 2017-10-30 18:22:10 +01:00
parent 812c88ec8c
commit 9a29e8ed82
No known key found for this signature in database
GPG key ID: 5FF1D117F918687F
3 changed files with 15 additions and 11 deletions

View file

@ -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);

View file

@ -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',
'<div id="controls"><div class="actions creatable"><div class="breadcrumb"><div class="crumb svg ui-droppable" data-dir="/"><a ng-click="logout()"><i class="fa fa-home"></i></a></div><div class="crumb svg" data-dir="/Test"><a ng-click="cancel()">{{active_vault.name}}</a></div><div class="crumb svg last" data-dir="/Test"><a ng-if="storedCredential.credential_id">{{ \'edit.credential\' | translate}} "{{storedCredential.label}}"</a> <a ng-if="!storedCredential.credential_id">{{ \'create.credential\' | translate}}</a></div></div></div></div><ul class="tab_header"><li ng-repeat="tab in tabs track by $index" class="tab" ng-class="{active:isActiveTab(tab)}" ng-click="onClickTab(tab)" use-theme color="\'true\'">{{tab.title}}<div class="indicator" use-theme negative="\'true\'"></div></li></ul><div class="tab_container edit_credential" use-theme type="\'border-top-color\'"><div ng-include="currentTab.url"></div><button ng-click="saveCredential()" click-disable>{{ \'save\' | translate}}</button> <button ng-click="cancel()">{{ \'cancel\' | translate}}</button></div>');
'<div id="controls"><div class="actions creatable"><div class="breadcrumb"><div class="crumb svg ui-droppable" data-dir="/"><a ng-click="logout()"><i class="fa fa-home"></i></a></div><div class="crumb svg" data-dir="/Test"><a ng-click="cancel()">{{active_vault.name}}</a></div><div class="crumb svg last" data-dir="/Test"><a ng-if="storedCredential.credential_id">{{ \'edit.credential\' | translate}} "{{storedCredential.label}}"</a> <a ng-if="!storedCredential.credential_id">{{ \'create.credential\' | translate}}</a></div></div></div></div><ul class="tab_header"><li ng-repeat="tab in tabs track by $index" class="tab" ng-class="{active:isActiveTab(tab)}" ng-click="onClickTab(tab)" use-theme color="\'true\'">{{tab.title}}<div class="indicator" use-theme negative="\'true\'"></div></li></ul><div class="tab_container edit_credential" use-theme type="\'border-top-color\'"><div ng-include="currentTab.url"></div><button ng-click="saveCredential()" ng-disabled="saving"><i class="fa fa-spinner fa-spin" ng-show="saving"></i> {{ \'save\' | translate}}</button> <button ng-click="cancel()">{{ \'cancel\' | translate}}</button></div>');
}]);
angular.module('views/partials/credential_template.html', []).run(['$templateCache', function ($templateCache) {

View file

@ -26,6 +26,6 @@
<div class="tab_container edit_credential" use-theme type="'border-top-color'">
<div ng-include="currentTab.url"></div>
<button ng-click="saveCredential()" click-disable>{{ 'save' | translate}}</button>
<button ng-click="saveCredential()" ng-disabled="saving"><i class="fa fa-spinner fa-spin" ng-show="saving"></i> {{ 'save' | translate}}</button>
<button ng-click="cancel()">{{ 'cancel' | translate}}</button>
</div>