diff options
Diffstat (limited to 'src/containers')
-rw-r--r-- | src/containers/auth/LockedScreen.js | 30 | ||||
-rw-r--r-- | src/containers/settings/EditSettingsScreen.js | 18 |
2 files changed, 32 insertions, 16 deletions
diff --git a/src/containers/auth/LockedScreen.js b/src/containers/auth/LockedScreen.js index aced64a98..a04107072 100644 --- a/src/containers/auth/LockedScreen.js +++ b/src/containers/auth/LockedScreen.js | |||
@@ -4,13 +4,9 @@ import { inject, observer } from 'mobx-react'; | |||
4 | import Locked from '../../components/auth/Locked'; | 4 | import Locked from '../../components/auth/Locked'; |
5 | import SettingsStore from '../../stores/SettingsStore'; | 5 | import SettingsStore from '../../stores/SettingsStore'; |
6 | 6 | ||
7 | import { globalError as globalErrorPropType } from '../../prop-types'; | 7 | import { hash } from '../../helpers/password-helpers'; |
8 | 8 | ||
9 | export default @inject('stores', 'actions') @observer class LockedScreen extends Component { | 9 | export default @inject('stores', 'actions') @observer class LockedScreen extends Component { |
10 | static propTypes = { | ||
11 | error: globalErrorPropType.isRequired, | ||
12 | }; | ||
13 | |||
14 | state = { | 10 | state = { |
15 | error: false, | 11 | error: false, |
16 | } | 12 | } |
@@ -30,7 +26,7 @@ export default @inject('stores', 'actions') @observer class LockedScreen extends | |||
30 | correctPassword = ''; | 26 | correctPassword = ''; |
31 | } | 27 | } |
32 | 28 | ||
33 | if (String(password) === String(correctPassword)) { | 29 | if (hash(String(password)) === String(correctPassword)) { |
34 | this.props.actions.settings.update({ | 30 | this.props.actions.settings.update({ |
35 | type: 'app', | 31 | type: 'app', |
36 | data: { | 32 | data: { |
@@ -56,17 +52,23 @@ export default @inject('stores', 'actions') @observer class LockedScreen extends | |||
56 | } | 52 | } |
57 | 53 | ||
58 | render() { | 54 | render() { |
59 | const { stores, error } = this.props; | 55 | const { stores } = this.props; |
60 | const { useTouchIdToUnlock } = this.props.stores.settings.all.app; | 56 | const { useTouchIdToUnlock } = this.props.stores.settings.all.app; |
61 | 57 | ||
62 | return ( | 58 | return ( |
63 | <Locked | 59 | <div className="auth"> |
64 | onSubmit={this.onSubmit} | 60 | <div className="auth__layout"> |
65 | unlock={this.unlock} | 61 | <div className="auth__container"> |
66 | useTouchIdToUnlock={useTouchIdToUnlock} | 62 | <Locked |
67 | isSubmitting={stores.user.loginRequest.isExecuting} | 63 | onSubmit={this.onSubmit} |
68 | error={this.state.error || error} | 64 | unlock={this.unlock} |
69 | /> | 65 | useTouchIdToUnlock={useTouchIdToUnlock} |
66 | isSubmitting={stores.user.loginRequest.isExecuting} | ||
67 | error={this.state.error || {}} | ||
68 | /> | ||
69 | </div> | ||
70 | </div> | ||
71 | </div> | ||
70 | ); | 72 | ); |
71 | } | 73 | } |
72 | } | 74 | } |
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 | }, |