aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/src
diff options
context:
space:
mode:
authorF. E Noel Nfebe <fenn25.fn@gmail.com>2025-04-15 12:56:40 +0200
committerGitHub <noreply@github.com>2025-04-15 12:56:40 +0200
commite5b34b700debe5f47bc413c29a746c033a06d641 (patch)
treeabecf85bc4bc7af3ec028b19e19f268be411eb4f /apps/files_sharing/src
parentfbb77270c21d9688cc97039c97a2842e7aaceeb8 (diff)
parentace0928759708a2a6df630c18da63154d1a7867a (diff)
downloadnextcloud-server-e5b34b700debe5f47bc413c29a746c033a06d641.tar.gz
nextcloud-server-e5b34b700debe5f47bc413c29a746c033a06d641.zip
Merge pull request #52121 from nextcloud/fix/no-issue/use-password-default-sharing-details
fix(files_sharing): Apply default password setting in SharingDetailsTab
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 9427bd78967..2c19afd1dca 100644
--- a/apps/files_sharing/src/components/SharingEntryLink.vue
+++ b/apps/files_sharing/src/components/SharingEntryLink.vue
@@ -228,7 +228,6 @@ import { showError, showSuccess } from '@nextcloud/dialogs'
import { ShareType } from '@nextcloud/sharing'
import VueQrcode from '@chenfengyuan/vue-qrcode'
import moment from '@nextcloud/moment'
-import Vue from 'vue'
import NcActionButton from '@nextcloud/vue/components/NcActionButton'
import NcActionCheckbox from '@nextcloud/vue/components/NcActionCheckbox'
@@ -391,23 +390,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 588b0bf4bc6..7d0d0dbb59b 100644
--- a/apps/files_sharing/src/mixins/SharesMixin.js
+++ b/apps/files_sharing/src/mixins/SharesMixin.js
@@ -11,6 +11,7 @@ import { emit } from '@nextcloud/event-bus'
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 3f7a20d8e0c..4411348d5ac 100644
--- a/apps/files_sharing/src/views/SharingDetailsTab.vue
+++ b/apps/files_sharing/src/views/SharingDetailsTab.vue
@@ -497,26 +497,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}
@@ -873,8 +853,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 */