Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[full-ci] Public link change password validation bugfix #8864

Merged
merged 2 commits into from
Apr 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Public link empty password stays forever

We've fixed a bug that caused the error message for the public link password to stay forever.

https://github.com/owncloud/web/pull/8864
https://github.com/owncloud/web/issues/8521
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,12 @@ export default defineComponent({
}
},
methods: {
...mapActions(['createModal', 'hideModal', 'setModalInputErrorMessage']),
...mapActions([
'createModal',
'hideModal',
'setModalInputErrorMessage',
'setModalConfirmButtonDisabled'
]),

isSelectedRole(role: ShareRole) {
return this.link.permissions === role.bitmask(false)
Expand Down Expand Up @@ -452,11 +457,14 @@ export default defineComponent({

checkPassword(password) {
if (password === '') {
this.setModalConfirmButtonDisabled(true)
return this.setModalInputErrorMessage(this.$gettext("Password can't be empty"))
}
if (password.length > 72) {
this.setModalConfirmButtonDisabled(true)
return this.setModalInputErrorMessage(this.$gettext("Password can't exceed 72 characters"))
}
this.setModalConfirmButtonDisabled(false)
return this.setModalInputErrorMessage(null)
},

Expand All @@ -467,7 +475,7 @@ export default defineComponent({
cancelText: this.$gettext('Cancel'),
confirmText: this.link.password ? this.$gettext('Apply') : this.$gettext('Set'),
hasInput: true,
inputDescription: this.$gettext("Password can't be empty"),
confirmDisabled: true,
inputLabel: this.$gettext('Password'),
inputType: 'password',
onCancel: this.hideModal,
Expand All @@ -484,7 +492,6 @@ export default defineComponent({
})
}
}

this.createModal(modal)
}
}
Expand Down
8 changes: 8 additions & 0 deletions packages/web-runtime/src/store/modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ const actions = {

toggleModalConfirmButton({ commit }) {
commit('TOGGLE_MODAL_CONFIRM_BUTTON')
},

setModalConfirmButtonDisabled({ commit }, status) {
commit('SET_MODAL_CONFIRM_BUTTON_DISABLED', status)
}
}

Expand Down Expand Up @@ -89,6 +93,10 @@ const mutations = {

TOGGLE_MODAL_CONFIRM_BUTTON(state) {
state.confirmDisabled = !state.confirmDisabled
},

SET_MODAL_CONFIRM_BUTTON_DISABLED(state, status) {
state.confirmDisabled = status
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const defaultStoreMockOptions = {
createModal: jest.fn(),
hideModal: jest.fn(),
toggleModalConfirmButton: jest.fn(),
setModalConfirmButtonDisabled: jest.fn(),
showMessage: jest.fn(),
deleteNotification: jest.fn(),
loadTheme: jest.fn(),
Expand Down