aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores/SettingsStore.js
diff options
context:
space:
mode:
authorLibravatar Bennett <hello@vantezzen.io>2020-05-03 16:07:02 +0200
committerLibravatar GitHub <noreply@github.com>2020-05-03 16:07:02 +0200
commit2f28ec495d5ba2f9368020391dd52da16ed008cd (patch)
treeb49b8186c578140bb860c5bf95c0177757b16178 /src/stores/SettingsStore.js
parentCreate SECURITY.md (#705) (diff)
downloadferdium-app-2f28ec495d5ba2f9368020391dd52da16ed008cd.tar.gz
ferdium-app-2f28ec495d5ba2f9368020391dd52da16ed008cd.tar.zst
ferdium-app-2f28ec495d5ba2f9368020391dd52da16ed008cd.zip
Add password hashing to lock password (#694)
Diffstat (limited to 'src/stores/SettingsStore.js')
-rw-r--r--src/stores/SettingsStore.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/stores/SettingsStore.js b/src/stores/SettingsStore.js
index dcf3c3b9d..c50475819 100644
--- a/src/stores/SettingsStore.js
+++ b/src/stores/SettingsStore.js
@@ -6,6 +6,7 @@ import localStorage from 'mobx-localstorage';
6import { DEFAULT_APP_SETTINGS, FILE_SYSTEM_SETTINGS_TYPES, LOCAL_SERVER } from '../config'; 6import { DEFAULT_APP_SETTINGS, FILE_SYSTEM_SETTINGS_TYPES, LOCAL_SERVER } from '../config';
7import { API } from '../environment'; 7import { API } from '../environment';
8import { getLocale } from '../helpers/i18n-helpers'; 8import { getLocale } from '../helpers/i18n-helpers';
9import { hash } from '../helpers/password-helpers';
9import { SPELLCHECKER_LOCALES } from '../i18n/languages'; 10import { SPELLCHECKER_LOCALES } from '../i18n/languages';
10import Request from './lib/Request'; 11import Request from './lib/Request';
11import Store from './lib/Store'; 12import Store from './lib/Store';
@@ -279,5 +280,25 @@ export default class SettingsStore extends Store {
279 280
280 debug('Migrated updates settings'); 281 debug('Migrated updates settings');
281 } 282 }
283
284 if (!this.all.migration['password-hashing']) {
285 if (this.stores.settings.app.lockedPassword !== '') {
286 this.actions.settings.update({
287 type: 'app',
288 data: {
289 lockedPassword: hash(String(legacySettings.lockedPassword)),
290 },
291 });
292 }
293
294 this.actions.settings.update({
295 type: 'migration',
296 data: {
297 'password-hashing': true,
298 },
299 });
300
301 debug('Migrated updates settings');
302 }
282 } 303 }
283} 304}