diff options
Diffstat (limited to 'src/containers/auth/LockedScreen.tsx')
-rw-r--r-- | src/containers/auth/LockedScreen.tsx | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/containers/auth/LockedScreen.tsx b/src/containers/auth/LockedScreen.tsx index 1b703207f..611a0757c 100644 --- a/src/containers/auth/LockedScreen.tsx +++ b/src/containers/auth/LockedScreen.tsx | |||
@@ -4,8 +4,17 @@ import { StoresProps } from '../../@types/ferdium-components.types'; | |||
4 | import Locked from '../../components/auth/Locked'; | 4 | import Locked from '../../components/auth/Locked'; |
5 | 5 | ||
6 | import { hash } from '../../helpers/password-helpers'; | 6 | import { hash } from '../../helpers/password-helpers'; |
7 | import { Actions } from '../../actions/lib/actions'; | ||
8 | import { RealStores } from '../../stores'; | ||
7 | 9 | ||
8 | class LockedScreen extends Component<StoresProps> { | 10 | interface IProps { |
11 | actions?: Actions; | ||
12 | stores?: RealStores; | ||
13 | } | ||
14 | |||
15 | @inject('stores', 'actions') | ||
16 | @observer | ||
17 | class LockedScreen extends Component<IProps> { | ||
9 | state = { | 18 | state = { |
10 | error: false, | 19 | error: false, |
11 | }; | 20 | }; |
@@ -20,13 +29,13 @@ class LockedScreen extends Component<StoresProps> { | |||
20 | onSubmit(values: any): void { | 29 | onSubmit(values: any): void { |
21 | const { password } = values; | 30 | const { password } = values; |
22 | 31 | ||
23 | let correctPassword = this.props.stores.settings.all.app.lockedPassword; | 32 | let correctPassword = this.props.stores!.settings.all.app.lockedPassword; |
24 | if (!correctPassword) { | 33 | if (!correctPassword) { |
25 | correctPassword = ''; | 34 | correctPassword = ''; |
26 | } | 35 | } |
27 | 36 | ||
28 | if (hash(String(password)) === String(correctPassword)) { | 37 | if (hash(String(password)) === String(correctPassword)) { |
29 | this.props.actions.settings.update({ | 38 | this.props.actions!.settings.update({ |
30 | type: 'app', | 39 | type: 'app', |
31 | data: { | 40 | data: { |
32 | locked: false, | 41 | locked: false, |
@@ -42,7 +51,7 @@ class LockedScreen extends Component<StoresProps> { | |||
42 | } | 51 | } |
43 | 52 | ||
44 | unlock(): void { | 53 | unlock(): void { |
45 | this.props.actions.settings.update({ | 54 | this.props.actions!.settings.update({ |
46 | type: 'app', | 55 | type: 'app', |
47 | data: { | 56 | data: { |
48 | locked: false, | 57 | locked: false, |
@@ -52,7 +61,7 @@ class LockedScreen extends Component<StoresProps> { | |||
52 | 61 | ||
53 | render(): ReactElement { | 62 | render(): ReactElement { |
54 | const { stores } = this.props; | 63 | const { stores } = this.props; |
55 | const { useTouchIdToUnlock } = this.props.stores.settings.all.app; | 64 | const { useTouchIdToUnlock } = this.props.stores!.settings.all.app; |
56 | 65 | ||
57 | return ( | 66 | return ( |
58 | <div className="auth"> | 67 | <div className="auth"> |
@@ -61,7 +70,7 @@ class LockedScreen extends Component<StoresProps> { | |||
61 | onSubmit={this.onSubmit} | 70 | onSubmit={this.onSubmit} |
62 | unlock={this.unlock} | 71 | unlock={this.unlock} |
63 | useTouchIdToUnlock={useTouchIdToUnlock} | 72 | useTouchIdToUnlock={useTouchIdToUnlock} |
64 | isSubmitting={stores.user.loginRequest.isExecuting} | 73 | isSubmitting={stores!.user.loginRequest.isExecuting} |
65 | error={this.state.error || {}} | 74 | error={this.state.error || {}} |
66 | /> | 75 | /> |
67 | </div> | 76 | </div> |
@@ -70,4 +79,4 @@ class LockedScreen extends Component<StoresProps> { | |||
70 | } | 79 | } |
71 | } | 80 | } |
72 | 81 | ||
73 | export default inject('stores', 'actions')(observer(LockedScreen)); | 82 | export default LockedScreen; |