diff options
author | 2020-05-03 16:07:02 +0200 | |
---|---|---|
committer | 2020-05-03 16:07:02 +0200 | |
commit | 2f28ec495d5ba2f9368020391dd52da16ed008cd (patch) | |
tree | b49b8186c578140bb860c5bf95c0177757b16178 /src/stores | |
parent | Create SECURITY.md (#705) (diff) | |
download | ferdium-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')
-rw-r--r-- | src/stores/SettingsStore.js | 21 |
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'; | |||
6 | import { DEFAULT_APP_SETTINGS, FILE_SYSTEM_SETTINGS_TYPES, LOCAL_SERVER } from '../config'; | 6 | import { DEFAULT_APP_SETTINGS, FILE_SYSTEM_SETTINGS_TYPES, LOCAL_SERVER } from '../config'; |
7 | import { API } from '../environment'; | 7 | import { API } from '../environment'; |
8 | import { getLocale } from '../helpers/i18n-helpers'; | 8 | import { getLocale } from '../helpers/i18n-helpers'; |
9 | import { hash } from '../helpers/password-helpers'; | ||
9 | import { SPELLCHECKER_LOCALES } from '../i18n/languages'; | 10 | import { SPELLCHECKER_LOCALES } from '../i18n/languages'; |
10 | import Request from './lib/Request'; | 11 | import Request from './lib/Request'; |
11 | import Store from './lib/Store'; | 12 | import 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 | } |