diff options
author | 2019-11-29 19:41:09 +0700 | |
---|---|---|
committer | 2019-11-29 19:41:09 +0700 | |
commit | b3c56428fa8fe15a35b70c5f5ca933ce2c0bba66 (patch) | |
tree | 982c30316842530af2f162fca0e5aaba96279b87 /src | |
parent | Fix cannot read property 'args' of null (diff) | |
download | ferdium-app-b3c56428fa8fe15a35b70c5f5ca933ce2c0bba66.tar.gz ferdium-app-b3c56428fa8fe15a35b70c5f5ca933ce2c0bba66.tar.zst ferdium-app-b3c56428fa8fe15a35b70c5f5ca933ce2c0bba66.zip |
Prevent Password Lock to trigger while not logged in
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/Menu.js | 4 | ||||
-rw-r--r-- | src/stores/SettingsStore.js | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/Menu.js b/src/lib/Menu.js index 941107adb..303845e55 100644 --- a/src/lib/Menu.js +++ b/src/lib/Menu.js | |||
@@ -800,7 +800,7 @@ export default class FranzMenu { | |||
800 | }, { | 800 | }, { |
801 | label: intl.formatMessage(menuItems.lockFerdi), | 801 | label: intl.formatMessage(menuItems.lockFerdi), |
802 | accelerator: 'CmdOrCtrl+Shift+L', | 802 | accelerator: 'CmdOrCtrl+Shift+L', |
803 | enabled: this.stores.settings.app.lockingFeatureEnabled, | 803 | enabled: this.stores.user.isLoggedIn && this.stores.settings.app.lockingFeatureEnabled, |
804 | click() { | 804 | click() { |
805 | // Disable lock first - otherwise the application might not update correctly | 805 | // Disable lock first - otherwise the application might not update correctly |
806 | actions.settings.update({ | 806 | actions.settings.update({ |
@@ -964,7 +964,7 @@ export default class FranzMenu { | |||
964 | this.currentTemplate = tpl; | 964 | this.currentTemplate = tpl; |
965 | const menu = Menu.buildFromTemplate(tpl); | 965 | const menu = Menu.buildFromTemplate(tpl); |
966 | const lockedMenu = Menu.buildFromTemplate([]); | 966 | const lockedMenu = Menu.buildFromTemplate([]); |
967 | Menu.setApplicationMenu(this.stores.settings.app.locked ? lockedMenu : menu); | 967 | Menu.setApplicationMenu(this.stores.user.isLoggedIn && this.stores.settings.app.locked ? lockedMenu : menu); |
968 | } | 968 | } |
969 | 969 | ||
970 | serviceTpl() { | 970 | serviceTpl() { |
diff --git a/src/stores/SettingsStore.js b/src/stores/SettingsStore.js index df0fc77e9..051e86be2 100644 --- a/src/stores/SettingsStore.js +++ b/src/stores/SettingsStore.js | |||
@@ -68,7 +68,6 @@ export default class SettingsStore extends Store { | |||
68 | () => this.all.app.locked, | 68 | () => this.all.app.locked, |
69 | () => { | 69 | () => { |
70 | const { router } = window.ferdi.stores; | 70 | const { router } = window.ferdi.stores; |
71 | |||
72 | if (this.all.app.locked && this.all.app.lockingFeatureEnabled) { | 71 | if (this.all.app.locked && this.all.app.lockingFeatureEnabled) { |
73 | // App just got locked, redirect to unlock screen | 72 | // App just got locked, redirect to unlock screen |
74 | router.push('/auth/locked'); | 73 | router.push('/auth/locked'); |
@@ -82,7 +81,8 @@ export default class SettingsStore extends Store { | |||
82 | 81 | ||
83 | // Make sure to lock app on launch if locking feature is enabled | 82 | // Make sure to lock app on launch if locking feature is enabled |
84 | setTimeout(() => { | 83 | setTimeout(() => { |
85 | if (this.all.app.lockingFeatureEnabled) { | 84 | const isLoggedIn = Boolean(localStorage.getItem('authToken')); |
85 | if (isLoggedIn && this.all.app.lockingFeatureEnabled) { | ||
86 | // Disable lock first - otherwise the lock might not get activated corrently | 86 | // Disable lock first - otherwise the lock might not get activated corrently |
87 | this.actions.settings.update({ | 87 | this.actions.settings.update({ |
88 | type: 'app', | 88 | type: 'app', |