Skip to content

Commit adb6306

Browse files
authored
Merge pull request #215 from BoldGrid/pro-issue-141
fixes broken access control in form submission
2 parents 3e88f7e + ab163ed commit adb6306

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

includes/class-ajax.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,8 +711,20 @@ public function handle_frontend_submission() {
711711
check_ajax_referer( 'wpuf_form_add' );
712712
$form_id = isset( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : 0;
713713
$page_id = isset( $_POST['page_id'] ) ? intval( $_POST['page_id'] ) : 0;
714-
715714
$form = weforms()->form->get( $form_id );
715+
716+
/**
717+
* Check if form submission is open. This resolves broken access control with unauthenticated users.
718+
* Access is now checked on frontend form rendering and submission.
719+
*/
720+
$form_submission_status = $form->is_submission_open();
721+
if ( is_wp_error( $form_submission_status ) ) {
722+
wp_send_json( [
723+
'success' => false,
724+
'error' => __( 'Login Required for submission.', 'weforms' ),
725+
] );
726+
}
727+
716728
$form_settings = $form->get_settings();
717729
$form_fields = $form->get_fields();
718730
$entry_fields = $form->prepare_entries();

0 commit comments

Comments
 (0)