From 24a86abdbc3e8a2a801e6c881f615974fd7f48b8 Mon Sep 17 00:00:00 2001 From: Antelle Date: Tue, 8 Dec 2015 21:02:50 +0300 Subject: [PATCH] fix #62: allow empty password --- app/scripts/views/open-view.js | 4 +++- .../views/settings/settings-file-view.js | 17 ++++++++++++----- release-notes.md | 1 + 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/app/scripts/views/open-view.js b/app/scripts/views/open-view.js index f6292872..5fa457a2 100644 --- a/app/scripts/views/open-view.js +++ b/app/scripts/views/open-view.js @@ -190,6 +190,8 @@ var OpenView = Backbone.View.extend({ if ($(e.target).is('.open__last-item-icon-del')) { this.model.removeFileInfo(id); this.$el.find('.open__last-item[data-id="' + id + '"]').remove(); + this.initialize(); + this.render(); return; } this.showOpenFileInfo(this.model.fileInfos.get(id)); @@ -197,7 +199,7 @@ var OpenView = Backbone.View.extend({ inputKeydown: function(e) { var code = e.keyCode || e.which; - if (code === Keys.DOM_VK_RETURN && this.passwordInput.length) { + if (code === Keys.DOM_VK_RETURN) { this.openDb(); } else if (code === Keys.DOM_VK_CAPS_LOCK) { this.$el.find('.open__pass-warning').removeClass('invisible'); diff --git a/app/scripts/views/settings/settings-file-view.js b/app/scripts/views/settings/settings-file-view.js index 9090f2bb..19c9f528 100644 --- a/app/scripts/views/settings/settings-file-view.js +++ b/app/scripts/views/settings/settings-file-view.js @@ -84,18 +84,25 @@ var SettingsAboutView = Backbone.View.extend({ validate: function() { if (!this.model.get('passwordLength')) { - Alerts.error({ + var that = this; + Alerts.yesno({ header: 'Empty password', - body: 'Please, enter the password. You will use it the next time you open this file.', - complete: (function() { this.$el.find('#settings__file-master-pass').focus(); }).bind(this) + body: 'Saving database with empty password makes it completely unprotected. Do you really want to do it?', + success: function() { + that.model.setPassword(kdbxweb.ProtectedValue.fromString('')); + that.saveToFile(true); + }, + cancel: function() { + that.$el.find('#settings__file-master-pass').focus(); + } }); return false; } return true; }, - saveToFile: function() { - if (!this.validate()) { + saveToFile: function(skipValidation) { + if (skipValidation !== true && !this.validate()) { return; } var that = this; diff --git a/release-notes.md b/release-notes.md index bbeeac11..d887a24e 100644 --- a/release-notes.md +++ b/release-notes.md @@ -7,6 +7,7 @@ Release notes `+` #46: option to show colorful icons `+` #45: optional auto-lock on minimize `+` option to disable searching for group +`+` #62: saving files with empty password `-` #55: custom scrollbar issues ##### v0.4.6 (2015-11-25)