fix #62: allow empty password

This commit is contained in:
Antelle 2015-12-08 21:02:50 +03:00
parent 5fc6780912
commit 24a86abdbc
3 changed files with 16 additions and 6 deletions

View File

@ -190,6 +190,8 @@ var OpenView = Backbone.View.extend({
if ($(e.target).is('.open__last-item-icon-del')) { if ($(e.target).is('.open__last-item-icon-del')) {
this.model.removeFileInfo(id); this.model.removeFileInfo(id);
this.$el.find('.open__last-item[data-id="' + id + '"]').remove(); this.$el.find('.open__last-item[data-id="' + id + '"]').remove();
this.initialize();
this.render();
return; return;
} }
this.showOpenFileInfo(this.model.fileInfos.get(id)); this.showOpenFileInfo(this.model.fileInfos.get(id));
@ -197,7 +199,7 @@ var OpenView = Backbone.View.extend({
inputKeydown: function(e) { inputKeydown: function(e) {
var code = e.keyCode || e.which; var code = e.keyCode || e.which;
if (code === Keys.DOM_VK_RETURN && this.passwordInput.length) { if (code === Keys.DOM_VK_RETURN) {
this.openDb(); this.openDb();
} else if (code === Keys.DOM_VK_CAPS_LOCK) { } else if (code === Keys.DOM_VK_CAPS_LOCK) {
this.$el.find('.open__pass-warning').removeClass('invisible'); this.$el.find('.open__pass-warning').removeClass('invisible');

View File

@ -84,18 +84,25 @@ var SettingsAboutView = Backbone.View.extend({
validate: function() { validate: function() {
if (!this.model.get('passwordLength')) { if (!this.model.get('passwordLength')) {
Alerts.error({ var that = this;
Alerts.yesno({
header: 'Empty password', header: 'Empty password',
body: 'Please, enter the password. You will use it the next time you open this file.', body: 'Saving database with empty password makes it completely unprotected. Do you really want to do it?',
complete: (function() { this.$el.find('#settings__file-master-pass').focus(); }).bind(this) success: function() {
that.model.setPassword(kdbxweb.ProtectedValue.fromString(''));
that.saveToFile(true);
},
cancel: function() {
that.$el.find('#settings__file-master-pass').focus();
}
}); });
return false; return false;
} }
return true; return true;
}, },
saveToFile: function() { saveToFile: function(skipValidation) {
if (!this.validate()) { if (skipValidation !== true && !this.validate()) {
return; return;
} }
var that = this; var that = this;

View File

@ -7,6 +7,7 @@ Release notes
`+` #46: option to show colorful icons `+` #46: option to show colorful icons
`+` #45: optional auto-lock on minimize `+` #45: optional auto-lock on minimize
`+` option to disable searching for group `+` option to disable searching for group
`+` #62: saving files with empty password
`-` #55: custom scrollbar issues `-` #55: custom scrollbar issues
##### v0.4.6 (2015-11-25) ##### v0.4.6 (2015-11-25)