aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/src
diff options
context:
space:
mode:
authornfebe <fenn25.fn@gmail.com>2025-04-11 10:14:38 +0100
committernfebe <fenn25.fn@gmail.com>2025-04-15 13:05:16 +0100
commit869a1002e46c60ab58f256dd768271add0c936da (patch)
tree57b0687983172facee075af3ae4c7761339eb80c /apps/files_sharing/src
parent24be03e96e29a6bb49082d4c8082738d27895abd (diff)
downloadnextcloud-server-869a1002e46c60ab58f256dd768271add0c936da.tar.gz
nextcloud-server-869a1002e46c60ab58f256dd768271add0c936da.zip
fix(files_sharing): Apply default password setting in SharingDetailsTab
Signed-off-by: nfebe <fenn25.fn@gmail.com>
Diffstat (limited to 'apps/files_sharing/src')
-rw-r--r--apps/files_sharing/src/components/SharingEntryLink.vue18
-rw-r--r--apps/files_sharing/src/mixins/SharesMixin.js21
-rw-r--r--apps/files_sharing/src/views/SharingDetailsTab.vue23
3 files changed, 23 insertions, 39 deletions
diff --git a/apps/files_sharing/src/components/SharingEntryLink.vue b/apps/files_sharing/src/components/SharingEntryLink.vue
index 0458fb6f0f0..606fb6a1c4d 100644
--- a/apps/files_sharing/src/components/SharingEntryLink.vue
+++ b/apps/files_sharing/src/components/SharingEntryLink.vue
@@ -219,7 +219,6 @@ import { emit } from '@nextcloud/event-bus'
import { generateUrl } from '@nextcloud/router'
import { showError, showSuccess } from '@nextcloud/dialogs'
import { ShareType } from '@nextcloud/sharing'
-import Vue from 'vue'
import VueQrcode from '@chenfengyuan/vue-qrcode'
import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
@@ -375,23 +374,6 @@ export default {
}
return null
},
- /**
- * Is the current share password protected ?
- *
- * @return {boolean}
- */
- isPasswordProtected: {
- get() {
- return this.config.enforcePasswordForPublicLink
- || !!this.share.password
- },
- async set(enabled) {
- // TODO: directly save after generation to make sure the share is always protected
- Vue.set(this.share, 'password', enabled ? await GeneratePassword(true) : '')
- Vue.set(this.share, 'newPassword', this.share.password)
- },
- },
-
passwordExpirationTime() {
if (this.share.passwordExpirationTime === null) {
return null
diff --git a/apps/files_sharing/src/mixins/SharesMixin.js b/apps/files_sharing/src/mixins/SharesMixin.js
index fbefebfcc36..84984c5d6c1 100644
--- a/apps/files_sharing/src/mixins/SharesMixin.js
+++ b/apps/files_sharing/src/mixins/SharesMixin.js
@@ -12,6 +12,7 @@ import { fetchNode } from '../services/WebdavClient.ts'
import PQueue from 'p-queue'
import debounce from 'debounce'
+import GeneratePassword from '../utils/GeneratePassword.ts'
import Share from '../models/Share.ts'
import SharesRequests from './ShareRequests.js'
import Config from '../services/ConfigService.ts'
@@ -156,6 +157,26 @@ export default {
}
return null
},
+ /**
+ * Is the current share password protected ?
+ *
+ * @return {boolean}
+ */
+ isPasswordProtected: {
+ get() {
+ return this.config.enforcePasswordForPublicLink
+ || !!this.share.password
+ },
+ async set(enabled) {
+ if (enabled) {
+ this.share.password = await GeneratePassword(true)
+ this.$set(this.share, 'newPassword', this.share.password)
+ } else {
+ this.share.password = ''
+ this.$delete(this.share, 'newPassword')
+ }
+ },
+ },
},
methods: {
diff --git a/apps/files_sharing/src/views/SharingDetailsTab.vue b/apps/files_sharing/src/views/SharingDetailsTab.vue
index b01a2ff7d18..f121279cbad 100644
--- a/apps/files_sharing/src/views/SharingDetailsTab.vue
+++ b/apps/files_sharing/src/views/SharingDetailsTab.vue
@@ -462,26 +462,6 @@ export default {
},
},
/**
- * Is the current share password protected ?
- *
- * @return {boolean}
- */
- isPasswordProtected: {
- get() {
- return this.config.enforcePasswordForPublicLink
- || !!this.share.password
- },
- async set(enabled) {
- if (enabled) {
- this.share.password = await GeneratePassword(true)
- this.$set(this.share, 'newPassword', this.share.password)
- } else {
- this.share.password = ''
- this.$delete(this.share, 'newPassword')
- }
- },
- },
- /**
* Is the current share a folder ?
*
* @return {boolean}
@@ -784,8 +764,9 @@ export default {
async initializeAttributes() {
if (this.isNewShare) {
- if (this.isPasswordEnforced && this.isPublicShare) {
+ if ((this.config.enableLinkPasswordByDefault || this.isPasswordEnforced) && this.isPublicShare) {
this.$set(this.share, 'newPassword', await GeneratePassword(true))
+ this.$set(this.share, 'password', this.share.newPassword)
this.advancedSectionAccordionExpanded = true
}
/* Set default expiration dates if configured */