mirror of https://github.com/keeweb/keeweb.git
Trigger fileinfo reset on keyfile change. Closes #845
This commit is contained in:
parent
0d85a08955
commit
cddd9bb8dc
|
@ -42,6 +42,7 @@ const AppModel = Backbone.Model.extend({
|
||||||
this.listenTo(Backbone, 'set-sort', this.setSort);
|
this.listenTo(Backbone, 'set-sort', this.setSort);
|
||||||
this.listenTo(Backbone, 'empty-trash', this.emptyTrash);
|
this.listenTo(Backbone, 'empty-trash', this.emptyTrash);
|
||||||
this.listenTo(Backbone, 'select-entry', this.selectEntry);
|
this.listenTo(Backbone, 'select-entry', this.selectEntry);
|
||||||
|
this.listenTo(Backbone, 'unset-keyfile', this.unsetKeyFile);
|
||||||
|
|
||||||
this.appLogger = new Logger('app');
|
this.appLogger = new Logger('app');
|
||||||
|
|
||||||
|
@ -891,6 +892,16 @@ const AppModel = Backbone.Model.extend({
|
||||||
this.fileInfos.save();
|
this.fileInfos.save();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
unsetKeyFile: function (fileId) {
|
||||||
|
const fileInfo = this.fileInfos.get(fileId)
|
||||||
|
fileInfo.set({
|
||||||
|
keyFileName: null,
|
||||||
|
keyFilePath: null,
|
||||||
|
keyFileHash: null
|
||||||
|
});
|
||||||
|
this.fileInfos.save()
|
||||||
|
},
|
||||||
|
|
||||||
setFileBackup: function(fileId, backup) {
|
setFileBackup: function(fileId, backup) {
|
||||||
const fileInfo = this.fileInfos.get(fileId);
|
const fileInfo = this.fileInfos.get(fileId);
|
||||||
if (fileInfo) {
|
if (fileInfo) {
|
||||||
|
|
|
@ -470,7 +470,8 @@ const FileModel = Backbone.Model.extend({
|
||||||
if (!changed && this.db.credentials.passwordHash === this._oldPasswordHash) {
|
if (!changed && this.db.credentials.passwordHash === this._oldPasswordHash) {
|
||||||
this.db.meta.keyChanged = this._oldKeyChangeDate;
|
this.db.meta.keyChanged = this._oldKeyChangeDate;
|
||||||
}
|
}
|
||||||
this.set({ keyFileName: '', keyFileChanged: changed });
|
this.set({ keyFileName: '', keyFilePath: '', keyFileChanged: changed });
|
||||||
|
Backbone.trigger('unset-keyfile', this.id)
|
||||||
this.setModified();
|
this.setModified();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue