aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue')
-rw-r--r--apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue40
1 files changed, 26 insertions, 14 deletions
diff --git a/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue b/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue
index 091679ae5c4..7e6d56e8794 100644
--- a/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue
+++ b/apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue
@@ -14,9 +14,9 @@
<fieldset class="file-request-dialog__expiration" data-cy-file-request-dialog-fieldset="expiration">
<!-- Enable expiration -->
<legend>{{ t('files_sharing', 'When should the request expire?') }}</legend>
- <NcCheckboxRadioSwitch v-show="!defaultExpireDateEnforced"
- :checked="defaultExpireDateEnforced || expirationDate !== null"
- :disabled="disabled || defaultExpireDateEnforced"
+ <NcCheckboxRadioSwitch v-show="!isExpirationDateEnforced"
+ :checked="isExpirationDateEnforced || expirationDate !== null"
+ :disabled="disabled || isExpirationDateEnforced"
@update:checked="onToggleDeadline">
{{ t('files_sharing', 'Set a submission expiration date') }}
</NcCheckboxRadioSwitch>
@@ -46,9 +46,9 @@
<fieldset class="file-request-dialog__password" data-cy-file-request-dialog-fieldset="password">
<!-- Enable password -->
<legend>{{ t('files_sharing', 'What password should be used for the request?') }}</legend>
- <NcCheckboxRadioSwitch v-show="!enforcePasswordForPublicLink"
- :checked="enforcePasswordForPublicLink || password !== null"
- :disabled="disabled || enforcePasswordForPublicLink"
+ <NcCheckboxRadioSwitch v-show="!isPasswordEnforced"
+ :checked="isPasswordEnforced || password !== null"
+ :disabled="disabled || isPasswordEnforced"
@update:checked="onTogglePassword">
{{ t('files_sharing', 'Set a password') }}
</NcCheckboxRadioSwitch>
@@ -59,7 +59,7 @@
:disabled="disabled"
:label="t('files_sharing', 'Password')"
:placeholder="t('files_sharing', 'Enter a valid password')"
- :required="false"
+ :required="enforcePasswordForPublicLink"
:value="password"
name="password"
@update:value="$emit('update:password', $event)" />
@@ -85,11 +85,11 @@
import { defineComponent, type PropType } from 'vue'
import { t } from '@nextcloud/l10n'
-import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
-import NcCheckboxRadioSwitch from '@nextcloud/vue/dist/Components/NcCheckboxRadioSwitch.js'
-import NcDateTimePickerNative from '@nextcloud/vue/dist/Components/NcDateTimePickerNative.js'
-import NcNoteCard from '@nextcloud/vue/dist/Components/NcNoteCard.js'
-import NcPasswordField from '@nextcloud/vue/dist/Components/NcPasswordField.js'
+import NcButton from '@nextcloud/vue/components/NcButton'
+import NcCheckboxRadioSwitch from '@nextcloud/vue/components/NcCheckboxRadioSwitch'
+import NcDateTimePickerNative from '@nextcloud/vue/components/NcDateTimePickerNative'
+import NcNoteCard from '@nextcloud/vue/components/NcNoteCard'
+import NcPasswordField from '@nextcloud/vue/components/NcPasswordField'
import IconInfo from 'vue-material-design-icons/Information.vue'
import IconPasswordGen from 'vue-material-design-icons/AutoFix.vue'
@@ -180,6 +180,18 @@ export default defineComponent({
return ''
},
+
+ isExpirationDateEnforced(): boolean {
+ // Both fields needs to be enabled in the settings
+ return this.defaultExpireDateEnabled
+ && this.defaultExpireDateEnforced
+ },
+
+ isPasswordEnforced(): boolean {
+ // Both fields needs to be enabled in the settings
+ return this.enableLinkPasswordByDefault
+ && this.enforcePasswordForPublicLink
+ },
},
mounted() {
@@ -189,12 +201,12 @@ export default defineComponent({
}
// If enforced, we cannot set a date before the default expiration days (see admin settings)
- if (this.defaultExpireDateEnforced) {
+ if (this.isExpirationDateEnforced) {
this.maxDate = sharingConfig.defaultExpirationDate
}
// If enabled by default, we generate a valid password
- if (this.enableLinkPasswordByDefault) {
+ if (this.isPasswordEnforced) {
this.generatePassword()
}
},