Skip to content

Commit

Permalink
Remove newPassword from share model, if disabled
Browse files Browse the repository at this point in the history
It's important to delete the `newPassword` prop from the share
 model, if the user unchecks the isPasswordProtected checkbox.

This clearer and allows for the unchecking to actually work as
`this.$set()` fails with the falsy value `''`.

Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
  • Loading branch information
nfebe committed Dec 6, 2023
1 parent 8b7f595 commit 2e21938
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions apps/files_sharing/src/views/SharingDetailsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,13 @@ export default {
|| !!this.share.password
},
async set(enabled) {
// TODO: directly save after generation to make sure the share is always protected
this.share.password = enabled ? await GeneratePassword() : ''
this.$set(this.share, 'newPassword', this.share.password)
if (enabled) {
this.share.password = await GeneratePassword()
this.$set(this.share, 'newPassword', this.share.password)
} else {
this.share.password = ''
this.$delete(this.share, 'newPassword')
}
},
},
/**
Expand Down

0 comments on commit 2e21938

Please sign in to comment.