diff options
author | 2020-05-03 16:07:02 +0200 | |
---|---|---|
committer | 2020-05-03 16:07:02 +0200 | |
commit | 2f28ec495d5ba2f9368020391dd52da16ed008cd (patch) | |
tree | b49b8186c578140bb860c5bf95c0177757b16178 /src/containers/settings/EditSettingsScreen.js | |
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/containers/settings/EditSettingsScreen.js')
-rw-r--r-- | src/containers/settings/EditSettingsScreen.js | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/containers/settings/EditSettingsScreen.js b/src/containers/settings/EditSettingsScreen.js index f6c2d4360..3dba3bc11 100644 --- a/src/containers/settings/EditSettingsScreen.js +++ b/src/containers/settings/EditSettingsScreen.js | |||
@@ -16,6 +16,7 @@ import { | |||
16 | import { config as spellcheckerConfig } from '../../features/spellchecker'; | 16 | import { config as spellcheckerConfig } from '../../features/spellchecker'; |
17 | 17 | ||
18 | import { getSelectOptions } from '../../helpers/i18n-helpers'; | 18 | import { getSelectOptions } from '../../helpers/i18n-helpers'; |
19 | import { hash } from '../../helpers/password-helpers'; | ||
19 | 20 | ||
20 | import EditSettingsForm from '../../components/settings/settings/EditSettingsForm'; | 21 | import EditSettingsForm from '../../components/settings/settings/EditSettingsForm'; |
21 | import ErrorBoundary from '../../components/util/ErrorBoundary'; | 22 | import ErrorBoundary from '../../components/util/ErrorBoundary'; |
@@ -185,6 +186,14 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e | |||
185 | intl: intlShape, | 186 | intl: intlShape, |
186 | }; | 187 | }; |
187 | 188 | ||
189 | constructor(props) { | ||
190 | super(props); | ||
191 | |||
192 | this.state = { | ||
193 | lockedPassword: '', | ||
194 | }; | ||
195 | } | ||
196 | |||
188 | onSubmit(settingsData) { | 197 | onSubmit(settingsData) { |
189 | const { todos, workspaces } = this.props.stores; | 198 | const { todos, workspaces } = this.props.stores; |
190 | const { | 199 | const { |
@@ -195,6 +204,10 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e | |||
195 | workspaces: workspaceActions, | 204 | workspaces: workspaceActions, |
196 | } = this.props.actions; | 205 | } = this.props.actions; |
197 | 206 | ||
207 | this.setState({ | ||
208 | lockedPassword: settingsData.lockedPassword, | ||
209 | }); | ||
210 | |||
198 | app.launchOnStartup({ | 211 | app.launchOnStartup({ |
199 | enable: settingsData.autoLaunchOnStart, | 212 | enable: settingsData.autoLaunchOnStart, |
200 | openInBackground: settingsData.autoLaunchInBackground, | 213 | openInBackground: settingsData.autoLaunchInBackground, |
@@ -217,7 +230,7 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e | |||
217 | predefinedTodoServer: settingsData.predefinedTodoServer, | 230 | predefinedTodoServer: settingsData.predefinedTodoServer, |
218 | customTodoServer: settingsData.customTodoServer, | 231 | customTodoServer: settingsData.customTodoServer, |
219 | lockingFeatureEnabled: settingsData.lockingFeatureEnabled, | 232 | lockingFeatureEnabled: settingsData.lockingFeatureEnabled, |
220 | lockedPassword: settingsData.lockedPassword, | 233 | lockedPassword: hash(String(settingsData.lockedPassword)), |
221 | useTouchIdToUnlock: settingsData.useTouchIdToUnlock, | 234 | useTouchIdToUnlock: settingsData.useTouchIdToUnlock, |
222 | inactivityLock: settingsData.inactivityLock, | 235 | inactivityLock: settingsData.inactivityLock, |
223 | scheduledDNDEnabled: settingsData.scheduledDNDEnabled, | 236 | scheduledDNDEnabled: settingsData.scheduledDNDEnabled, |
@@ -273,6 +286,7 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e | |||
273 | app, settings, user, todos, workspaces, | 286 | app, settings, user, todos, workspaces, |
274 | } = this.props.stores; | 287 | } = this.props.stores; |
275 | const { intl } = this.context; | 288 | const { intl } = this.context; |
289 | const { lockedPassword } = this.state; | ||
276 | 290 | ||
277 | const locales = getSelectOptions({ | 291 | const locales = getSelectOptions({ |
278 | locales: APP_LOCALES, | 292 | locales: APP_LOCALES, |
@@ -395,7 +409,7 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e | |||
395 | }, | 409 | }, |
396 | lockedPassword: { | 410 | lockedPassword: { |
397 | label: intl.formatMessage(messages.lockPassword), | 411 | label: intl.formatMessage(messages.lockPassword), |
398 | value: settings.all.app.lockedPassword, | 412 | value: lockedPassword, |
399 | default: '', | 413 | default: '', |
400 | type: 'password', | 414 | type: 'password', |
401 | }, | 415 | }, |