Added fingerprint support for changed password

This commit is contained in:
Alex Shpak 2017-05-03 01:19:25 +02:00
parent 14b953f764
commit 59fa9253b3
2 changed files with 19 additions and 6 deletions

View File

@ -48,10 +48,14 @@ const Launcher = {
}, callback);
};
const filePath = this.parsePath(path);
window.resolveLocalFileSystemURL(filePath.dir, dir => {
dir.getFile(filePath.file, {create: true}, writeFile);
}, callback, callback);
if (path.startsWith('cdvfile://')) { // then file exists
window.resolveLocalFileSystemURL(path, writeFile, callback, callback);
} else { // create file on sd card
const filePath = this.parsePath(path);
window.resolveLocalFileSystemURL(filePath.dir, dir => {
dir.getFile(filePath.file, {create: true}, writeFile);
}, callback, callback);
}
},
readFile: function(path, encoding, callback) {
window.resolveLocalFileSystemURL(path, fileEntry => {
@ -187,7 +191,7 @@ const Launcher = {
const encryptConfig = _.extend({}, this.config, {
username: fileId,
password: password.getText()
password: password
});
FingerprintAuth.encrypt(encryptConfig, result => {

View File

@ -163,7 +163,16 @@ const SettingsFileView = Backbone.View.extend({
return;
}
}
this.appModel.syncFile(this.model, arg);
const password = this.$el.find('#settings__file-master-pass').val();
const shouldUpdateFingerprint = this.model.get('passwordChanged') && this.model.get('fingerprint'); // save to suggest fingerprint auth after sync
this.appModel.syncFile(this.model, arg, () => {
if (shouldUpdateFingerprint) {
this.model.set('fingerprint', null); // erase old fingerprint token
this.appModel.saveFileFingerprint(this.model, password);
}
});
},
saveDefault: function() {