diff options
Diffstat (limited to 'src/stores/SettingsStore.js')
-rw-r--r-- | src/stores/SettingsStore.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/stores/SettingsStore.js b/src/stores/SettingsStore.js index 2975499b3..f6a53f147 100644 --- a/src/stores/SettingsStore.js +++ b/src/stores/SettingsStore.js | |||
@@ -62,6 +62,34 @@ export default class SettingsStore extends Store { | |||
62 | this.all.app.autohideMenuBar, | 62 | this.all.app.autohideMenuBar, |
63 | ), | 63 | ), |
64 | ); | 64 | ); |
65 | |||
66 | reaction( | ||
67 | () => this.all.app.locked, | ||
68 | () => { | ||
69 | const { router } = window.ferdi.stores; | ||
70 | |||
71 | if (this.all.app.locked && this.all.app.lockingFeatureEnabled) { | ||
72 | // App just got locked, redirect to unlock screen | ||
73 | router.push('/auth/locked'); | ||
74 | } else if (router.location.pathname.includes('/auth/locked')) { | ||
75 | // App is unlocked but user is still on locked screen | ||
76 | // Redirect to homepage | ||
77 | router.push('/'); | ||
78 | } | ||
79 | }, | ||
80 | ); | ||
81 | |||
82 | // Make sure to lock app on launch if locking feature is enabled | ||
83 | setTimeout(() => { | ||
84 | if (this.all.app.lockingFeatureEnabled) { | ||
85 | this.actions.settings.update({ | ||
86 | type: 'app', | ||
87 | data: { | ||
88 | locked: true, | ||
89 | }, | ||
90 | }); | ||
91 | } | ||
92 | }, 1000); | ||
65 | } | 93 | } |
66 | 94 | ||
67 | @computed get app() { | 95 | @computed get app() { |