Merge pull request #48991 from nextcloud/fix/password-field-sharing

fix(files_sharing): Password field must not be required if already set
pull/49015/head
Ferdinand Thiessen 2024-10-30 13:40:19 +07:00 committed by GitHub
commit 878ccc406b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 22 additions and 10 deletions

@ -116,8 +116,8 @@
autocomplete="new-password" autocomplete="new-password"
:value="hasUnsavedPassword ? share.newPassword : ''" :value="hasUnsavedPassword ? share.newPassword : ''"
:error="passwordError" :error="passwordError"
:helper-text="errorPasswordLabel" :helper-text="errorPasswordLabel || passwordHint"
:required="isPasswordEnforced" :required="isPasswordEnforced && isNewShare"
:label="t('files_sharing', 'Password')" :label="t('files_sharing', 'Password')"
@update:value="onPasswordChange" /> @update:value="onPasswordChange" />
@ -723,6 +723,13 @@ export default {
return undefined return undefined
}, },
passwordHint() {
if (this.isNewShare || this.hasUnsavedPassword) {
return undefined
}
return t('files_sharing', 'Replace current password')
},
/** /**
* Additional actions for the menu * Additional actions for the menu
* *
@ -887,7 +894,7 @@ export default {
if (this.hasUnsavedPassword && this.isValidShareAttribute(this.share.newPassword)) { if (this.hasUnsavedPassword && this.isValidShareAttribute(this.share.newPassword)) {
this.share.password = this.share.newPassword this.share.password = this.share.newPassword
this.$delete(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 this.passwordError = true
} }
} else { } else {
@ -981,6 +988,11 @@ export default {
* @param {string} password the changed password * @param {string} password the changed password
*/ */
onPasswordChange(password) { onPasswordChange(password) {
if (password === '') {
this.$delete(this.share, 'newPassword')
this.passwordError = this.isNewShare && this.isPasswordEnforced
return
}
this.passwordError = !this.isValidShareAttribute(password) this.passwordError = !this.isValidShareAttribute(password)
this.$set(this.share, 'newPassword', password) this.$set(this.share, 'newPassword', password)
}, },

File diff suppressed because one or more lines are too long

@ -1 +0,0 @@
2093-2093.js.license

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
5419-5419.js.license

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long