Skip to content

Commit 8a2e561

Browse files
committed
Show pending popover menu when password is enabled by default
When "Enforce password protection" is enabled in the sharing settings a popover menu is shown to set a password before the share is created. On the other hand, when "Always ask for a password" was enabled in the sharing settings and a new link share was created the share was immediately created with a default password; the user was not able to specify a password (nor create the share without password). The component template already provided the needed elements to also ask for the password without enforcing it, but the popover menu was not shown due to "enableLinkPasswordByDefault" being missing in "if" conditions. Signed-off-by: Daniel Calviño Sánchez <[email protected]>
1 parent fc353bc commit 8a2e561

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

apps/files_sharing/src/components/SharingEntryLink.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
</NcActions>
4848

4949
<!-- pending actions -->
50-
<NcActions v-if="!pending && (pendingEnforcedPassword || pendingExpirationDate)"
50+
<NcActions v-if="!pending && (pendingPassword || pendingEnforcedPassword || pendingExpirationDate)"
5151
class="sharing-entry__actions"
5252
:aria-label="actionsTooltip"
5353
menu-align="right"
@@ -67,7 +67,7 @@
6767
<NcActionText v-if="pendingEnforcedPassword" icon="icon-password">
6868
{{ t('files_sharing', 'Password protection (enforced)') }}
6969
</NcActionText>
70-
<NcActionCheckbox v-else-if="config.enableLinkPasswordByDefault"
70+
<NcActionCheckbox v-else-if="pendingPassword"
7171
:checked.sync="isPasswordProtected"
7272
:disabled="config.enforcePasswordForPublicLink || saving"
7373
class="share-link-password-checkbox"
@@ -515,6 +515,9 @@ export default {
515515
*
516516
* @return {boolean}
517517
*/
518+
pendingPassword() {
519+
return this.config.enableLinkPasswordByDefault && this.share && !this.share.id
520+
},
518521
pendingEnforcedPassword() {
519522
return this.config.enforcePasswordForPublicLink && this.share && !this.share.id
520523
},
@@ -612,12 +615,9 @@ export default {
612615
// expiration is the share object key, not expireDate
613616
shareDefaults.expiration = this.formatDateToString(this.config.defaultExpirationDate)
614617
}
615-
if (this.config.enableLinkPasswordByDefault) {
616-
shareDefaults.password = await GeneratePassword()
617-
}
618618
619619
// do not push yet if we need a password or an expiration date: show pending menu
620-
if (this.config.enforcePasswordForPublicLink || this.config.isDefaultExpireDateEnforced) {
620+
if (this.config.enableLinkPasswordByDefault || this.config.enforcePasswordForPublicLink || this.config.isDefaultExpireDateEnforced) {
621621
this.pending = true
622622
623623
// if a share already exists, pushing it
@@ -640,8 +640,8 @@ export default {
640640
}
641641
642642
// ELSE, show the pending popovermenu
643-
// if password enforced, pre-fill with random one
644-
if (this.config.enforcePasswordForPublicLink) {
643+
// if password default or enforced, pre-fill with random one
644+
if (this.config.enableLinkPasswordByDefault || this.config.enforcePasswordForPublicLink) {
645645
shareDefaults.password = await GeneratePassword()
646646
}
647647

dist/core-common.js

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

dist/core-common.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files_sharing-files_sharing_tab.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files_sharing-files_sharing_tab.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)