Skip to content

Commit

Permalink
Merge pull request #48991 from nextcloud/fix/password-field-sharing
Browse files Browse the repository at this point in the history
fix(files_sharing): Password field must not be required if already set
  • Loading branch information
susnux authored Oct 30, 2024
2 parents 399b048 + e13b6d3 commit 878ccc4
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 @@ -723,6 +723,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 @@ -887,7 +894,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 @@ -981,6 +988,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
1 change: 0 additions & 1 deletion dist/2093-2093.js.map

This file was deleted.

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

This file was deleted.

4 changes: 2 additions & 2 deletions dist/2093-2093.js → dist/5419-5419.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/5419-5419.js.map.license
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 878ccc4

Please sign in to comment.