Skip to content

Commit

Permalink
fix(settings): Show feedback 4 server-sde encryption toggle
Browse files Browse the repository at this point in the history
Show visual feedback if user clicks on encryption toggle when it cannot be activated.

Signed-off-by: nfebe <fenn25.fn@gmail.com>
  • Loading branch information
nfebe committed Nov 22, 2024
1 parent bf7ec2e commit 61bac10
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions apps/settings/src/components/Encryption.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
{{ t('settings', 'Enable server-side encryption') }}
</NcCheckboxRadioSwitch>

<div v-if="!hasEncryptionModules || !encryptionReady" class="notecard warning" role="alert">
<p>{{ t('settings', 'Encryption is not ready. Please enable an encryption module or app.') }}</p>
</div>

<div v-if="shouldDisplayWarning && !encryptionEnabled" class="notecard warning" role="alert">
<p>{{ t('settings', 'Please read carefully before activating server-side encryption:') }}</p>
<ul>
Expand All @@ -34,7 +38,7 @@

<div v-if="encryptionEnabled">
<div v-if="encryptionReady">
<p v-if="encryptionModules.length === 0">
<p v-if="!hasEncryptionModules">
{{ t('settings', 'No encryption module loaded, please enable an encryption module in the app menu.') }}
</p>
<template v-else>
Expand Down Expand Up @@ -89,8 +93,9 @@ export default {
},
data() {
const encryptionModules = loadState('settings', 'encryption-modules')
const hasEncryptionModules = encryptionModules instanceof Array && encryptionModules.length > 0
let defaultCheckedModule = ''
if (encryptionModules instanceof Array && encryptionModules.length > 0) {
if (hasEncryptionModules) {
const defaultModule = Object.entries(encryptionModules).find((module) => module[1].default)
if (defaultModule) {
defaultCheckedModule = foundModule[0]
Expand All @@ -107,6 +112,7 @@ export default {
shouldDisplayWarning: false,
migrating: false,
defaultCheckedModule,
hasEncryptionModules,
}
},
methods: {
Expand Down

0 comments on commit 61bac10

Please sign in to comment.