|
116 | 116 | autocomplete="new-password" |
117 | 117 | :value="hasUnsavedPassword ? share.newPassword : ''" |
118 | 118 | :error="passwordError" |
119 | | - :helper-text="errorPasswordLabel" |
120 | | - :required="isPasswordEnforced" |
| 119 | + :helper-text="errorPasswordLabel || passwordHint" |
| 120 | + :required="isPasswordEnforced && isNewShare" |
121 | 121 | :label="t('files_sharing', 'Password')" |
122 | 122 | @update:value="onPasswordChange" /> |
123 | 123 |
|
@@ -723,6 +723,13 @@ export default { |
723 | 723 | return undefined |
724 | 724 | }, |
725 | 725 |
|
| 726 | + passwordHint() { |
| 727 | + if (this.isNewShare || this.hasUnsavedPassword) { |
| 728 | + return undefined |
| 729 | + } |
| 730 | + return t('files_sharing', 'Replace current password') |
| 731 | + }, |
| 732 | +
|
726 | 733 | /** |
727 | 734 | * Additional actions for the menu |
728 | 735 | * |
@@ -887,7 +894,7 @@ export default { |
887 | 894 | if (this.hasUnsavedPassword && this.isValidShareAttribute(this.share.newPassword)) { |
888 | 895 | this.share.password = this.share.newPassword |
889 | 896 | 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)) { |
891 | 898 | this.passwordError = true |
892 | 899 | } |
893 | 900 | } else { |
@@ -981,6 +988,11 @@ export default { |
981 | 988 | * @param {string} password the changed password |
982 | 989 | */ |
983 | 990 | onPasswordChange(password) { |
| 991 | + if (password === '') { |
| 992 | + this.$delete(this.share, 'newPassword') |
| 993 | + this.passwordError = this.isNewShare && this.isPasswordEnforced |
| 994 | + return |
| 995 | + } |
984 | 996 | this.passwordError = !this.isValidShareAttribute(password) |
985 | 997 | this.$set(this.share, 'newPassword', password) |
986 | 998 | }, |
|
0 commit comments