Skip to content

Commit a4cb6a6

Browse files
committed
enforcePassword
1 parent 50ec48c commit a4cb6a6

File tree

4 files changed

+38
-3
lines changed

4 files changed

+38
-3
lines changed

src/components/Popup/MainBody.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ export default Vue.extend({
6060
computed,
6161
methods: {
6262
showInfo(page: string) {
63+
if (page === "AddMethodPage") {
64+
if (
65+
this.$store.state.menu.enforcePassword &&
66+
!this.$store.state.accounts.encryption.getEncryptionStatus()
67+
) {
68+
page = "SetPasswordPage";
69+
}
70+
}
71+
6372
this.$store.commit("style/showInfo");
6473
this.$store.commit("currentView/changeView", page);
6574
},

src/components/Popup/MainHeader.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@ export default Vue.extend({
104104
return;
105105
},
106106
async beginCapture() {
107+
if (
108+
this.$store.state.menu.enforcePassword &&
109+
!this.$store.state.accounts.encryption.getEncryptionStatus()
110+
) {
111+
this.$store.commit("style/showInfo");
112+
this.$store.commit("currentView/changeView", "SetPasswordPage");
113+
return;
114+
}
107115
// Insert content script
108116
await new Promise(
109117
(resolve: () => void, reject: (reason: Error) => void) => {

src/components/Popup/SetPasswordPage.vue

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,20 @@
1010
v-model="confirm"
1111
v-on:keyup.enter="changePassphrase()"
1212
/>
13-
<div id="security-save" v-on:click="changePassphrase()">{{ i18n.ok }}</div>
14-
<div id="security-remove" v-on:click="removePassphrase()">
15-
{{ i18n.remove }}
13+
<div v-show="!enforcePassword">
14+
<div id="security-save" v-on:click="changePassphrase()">
15+
{{ i18n.ok }}
16+
</div>
17+
<div id="security-remove" v-on:click="removePassphrase()">
18+
{{ i18n.remove }}
19+
</div>
20+
</div>
21+
<div
22+
class="button-small"
23+
v-show="enforcePassword"
24+
v-on:click="changePassphrase()"
25+
>
26+
{{ i18n.ok }}
1627
</div>
1728
</div>
1829
</template>
@@ -26,6 +37,11 @@ export default Vue.extend({
2637
confirm: ""
2738
};
2839
},
40+
computed: {
41+
enforcePassword: function() {
42+
return this.$store.state.menu.enforcePassword;
43+
}
44+
},
2945
methods: {
3046
async removePassphrase() {
3147
await this.$store.dispatch("accounts/changePassphrase", "");

src/store/Menu.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ export class Menu implements IModule {
1111
autolock: Number(localStorage.autolock) || 0,
1212
backupDisabled: await ManagedStorage.get("disableBackup"),
1313
exportDisabled: await ManagedStorage.get("disableExport"),
14+
enforcePassword: await ManagedStorage.get("enforcePassword"),
15+
enforceAutolock: await ManagedStorage.get("enforceAutolock"),
1416
storageArea: await ManagedStorage.get("storageArea"),
1517
feedbackURL: await ManagedStorage.get("feedbackURL")
1618
},

0 commit comments

Comments
 (0)