Skip to content

Commit

Permalink
fix(webapp): correctly show captcha errors, fixes #931
Browse files Browse the repository at this point in the history
  • Loading branch information
peterthomassen committed Dec 18, 2024
1 parent 8d0fc1a commit 13cd1c4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions www/webapp/src/components/Field/GenericCaptcha.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ export default {
this.working = false;
this.emitChange();
},
addError(values) {
this.errors.push(values);
addError(...values) {
this.errors.push(...values);
},
captchaID() {
return this.captcha.id;
Expand Down
8 changes: 7 additions & 1 deletion www/webapp/src/views/ConfirmationPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,13 @@
let errors = await digestError(ex);
this.post_response = ex.response
for (const c in errors) {
this.errors.push(...errors[c])
if (c === 'captcha' && this.$refs.actionHandler.$refs.captchaField !== undefined) {
this.$refs.actionHandler.$refs.captchaField.addError(...(errors[c]['id'] ?? []));
this.$refs.actionHandler.$refs.captchaField.addError(...(errors[c]['non_field_errors'] ?? []));
this.$refs.actionHandler.$refs.captchaField.addError(...(errors[c]['solution'] ?? []));
} else {
this.errors.push(...errors[c]);
}
}
}
this.working = false
Expand Down

0 comments on commit 13cd1c4

Please sign in to comment.