Skip to content

Commit 878ccc4

Browse files
authored
Merge pull request nextcloud#48991 from nextcloud/fix/password-field-sharing
fix(files_sharing): Password field must not be required if already set
2 parents 399b048 + e13b6d3 commit 878ccc4

9 files changed

+22
-10
lines changed

apps/files_sharing/src/views/SharingDetailsTab.vue

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@
116116
autocomplete="new-password"
117117
:value="hasUnsavedPassword ? share.newPassword : ''"
118118
:error="passwordError"
119-
:helper-text="errorPasswordLabel"
120-
:required="isPasswordEnforced"
119+
:helper-text="errorPasswordLabel || passwordHint"
120+
:required="isPasswordEnforced && isNewShare"
121121
:label="t('files_sharing', 'Password')"
122122
@update:value="onPasswordChange" />
123123

@@ -723,6 +723,13 @@ export default {
723723
return undefined
724724
},
725725
726+
passwordHint() {
727+
if (this.isNewShare || this.hasUnsavedPassword) {
728+
return undefined
729+
}
730+
return t('files_sharing', 'Replace current password')
731+
},
732+
726733
/**
727734
* Additional actions for the menu
728735
*
@@ -887,7 +894,7 @@ export default {
887894
if (this.hasUnsavedPassword && this.isValidShareAttribute(this.share.newPassword)) {
888895
this.share.password = this.share.newPassword
889896
this.$delete(this.share, 'newPassword')
890-
} else if (this.isPasswordEnforced && !this.isValidShareAttribute(this.share.password)) {
897+
} else if (this.isPasswordEnforced && this.isNewShare && !this.isValidShareAttribute(this.share.password)) {
891898
this.passwordError = true
892899
}
893900
} else {
@@ -981,6 +988,11 @@ export default {
981988
* @param {string} password the changed password
982989
*/
983990
onPasswordChange(password) {
991+
if (password === '') {
992+
this.$delete(this.share, 'newPassword')
993+
this.passwordError = this.isNewShare && this.isPasswordEnforced
994+
return
995+
}
984996
this.passwordError = !this.isValidShareAttribute(password)
985997
this.$set(this.share, 'newPassword', password)
986998
},

dist/2093-2093.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/2093-2093.js.map.license

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/2093-2093.js renamed to dist/5419-5419.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.
File renamed without changes.

dist/5419-5419.js.map

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

dist/5419-5419.js.map.license

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
5419-5419.js.license

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)