Skip to content

Commit

Permalink
Merge pull request #49013 from nextcloud/backport/48991/stable30
Browse files Browse the repository at this point in the history
[stable30] fix(files_sharing): Password field must not be required if already set
  • Loading branch information
susnux authored Oct 30, 2024
2 parents 69bf5f1 + 72e0e08 commit 2ebef1e
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 10 deletions.
18 changes: 15 additions & 3 deletions apps/files_sharing/src/views/SharingDetailsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@
autocomplete="new-password"
:value="hasUnsavedPassword ? share.newPassword : ''"
:error="passwordError"
:helper-text="errorPasswordLabel"
:required="isPasswordEnforced"
:helper-text="errorPasswordLabel || passwordHint"
:required="isPasswordEnforced && isNewShare"
:label="t('files_sharing', 'Password')"
@update:value="onPasswordChange" />

Expand Down Expand Up @@ -713,6 +713,13 @@ export default {
return undefined
},

passwordHint() {
if (this.isNewShare || this.hasUnsavedPassword) {
return undefined
}
return t('files_sharing', 'Replace current password')
},

/**
* Additional actions for the menu
*
Expand Down Expand Up @@ -877,7 +884,7 @@ export default {
if (this.hasUnsavedPassword && this.isValidShareAttribute(this.share.newPassword)) {
this.share.password = this.share.newPassword
this.$delete(this.share, 'newPassword')
} else if (this.isPasswordEnforced && !this.isValidShareAttribute(this.share.password)) {
} else if (this.isPasswordEnforced && this.isNewShare && !this.isValidShareAttribute(this.share.password)) {
this.passwordError = true
}
} else {
Expand Down Expand Up @@ -971,6 +978,11 @@ export default {
* @param {string} password the changed password
*/
onPasswordChange(password) {
if (password === '') {
this.$delete(this.share, 'newPassword')
this.passwordError = this.isNewShare && this.isPasswordEnforced
return
}
this.passwordError = !this.isValidShareAttribute(password)
this.$set(this.share, 'newPassword', password)
},
Expand Down
4 changes: 2 additions & 2 deletions dist/6818-6818.js → dist/3154-3154.js

Large diffs are not rendered by default.

File renamed without changes.
1 change: 1 addition & 0 deletions dist/3154-3154.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/3154-3154.js.map.license
1 change: 0 additions & 1 deletion dist/6818-6818.js.map

This file was deleted.

1 change: 0 additions & 1 deletion dist/6818-6818.js.map.license

This file was deleted.

4 changes: 2 additions & 2 deletions dist/files_sharing-files_sharing_tab.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files_sharing-files_sharing_tab.js.map

Large diffs are not rendered by default.

0 comments on commit 2ebef1e

Please sign in to comment.