diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-10-29 23:54:03 +0100 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-10-30 16:45:31 +0100 |
commit | 5f157d186efc2fb9b4299f83653b5e08126125f6 (patch) | |
tree | 5946997f3a6103ebd9a78ce87253422916256477 | |
parent | 5787e5f27d21e36f18d000e8fe5328b8d5fed952 (diff) | |
download | nextcloud-server-backport/48991/stable30.tar.gz nextcloud-server-backport/48991/stable30.zip |
fix(files_sharing): Password field must not be required if already setbackport/48991/stable30
If there is already a password, there is no need to require the password
in the setting ('newPassword'). It is only required for new shares.
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
-rw-r--r-- | apps/files_sharing/src/views/SharingDetailsTab.vue | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/apps/files_sharing/src/views/SharingDetailsTab.vue b/apps/files_sharing/src/views/SharingDetailsTab.vue index c724a655e92..92424889f08 100644 --- a/apps/files_sharing/src/views/SharingDetailsTab.vue +++ b/apps/files_sharing/src/views/SharingDetailsTab.vue @@ -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" /> @@ -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 * @@ -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 { @@ -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) }, |