Skip to content

Commit 6ff762e

Browse files
authored
Merge pull request #891 from kprajapatii/master
Improper Access Control fixes - FIXED/SECURITY
2 parents 75b6552 + cd9221d commit 6ff762e

5 files changed

Lines changed: 70 additions & 25 deletions

File tree

admin/settings/class-formbuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1818,7 +1818,7 @@ public static function validation_pattern( $output, $result_str, $cf, $field_inf
18181818
'label' => __( 'Validation Pattern', 'userswp' ) . uwp_help_tip( __( 'Enter regex expression for HTML5 pattern validation.', 'userswp' ) ),
18191819
'type' => 'text',
18201820
'wrap_class' => uwp_advanced_toggle_class(),
1821-
'value' => addslashes_gpc( $value ), // Keep slashes
1821+
'value' => wp_slash( $value ), // Keep slashes
18221822
)
18231823
);
18241824

assets/js/users-wp.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,9 @@ jQuery(window).on('load',function () {
106106
$( '.uwp_upload_file_remove' ).on( 'click', function( event ) {
107107
event.preventDefault();
108108

109-
var htmlvar = $( this ).data( 'htmlvar' );
110-
var uid = $( this ).data( 'uid' );
109+
var $this = $(this);
110+
var htmlvar = $this.data( 'htmlvar' );
111+
var uid = $this.data( 'uid' );
111112

112113
var data = {
113114
'action': 'uwp_upload_file_remove',
@@ -116,17 +117,25 @@ jQuery(window).on('load',function () {
116117
'security': uwp_localize_data.basicNonce
117118
};
118119

120+
if ($this.closest("form").find('.uwp-field-error').length) {
121+
$this.closest("form").find('.uwp-field-error').remove();
122+
}
123+
119124
jQuery.ajax({
120125
url: uwp_localize_data.ajaxurl,
121126
type: 'POST',
122127
data: data,
123128
dataType: 'json'
124129
}).done(function(res, textStatus, jqXHR) {
125-
if (typeof res == 'object' && res.success) {
126-
$("#"+htmlvar+"_row").find(".uwp_file_preview_wrap").remove();
127-
$("#"+htmlvar).closest("td").find(".uwp_file_preview_wrap").remove();
128-
if($('input[name='+htmlvar+']').data( 'is-required' )){
129-
$('input[name='+htmlvar+']').prop('required',true);
130+
if (res && typeof res == 'object') {
131+
if (res.success) {
132+
$("#"+htmlvar+"_row").find(".uwp_file_preview_wrap").remove();
133+
$("#"+htmlvar).closest("td").find(".uwp_file_preview_wrap").remove();
134+
if($('input[name='+htmlvar+']').data( 'is-required' )){
135+
$('input[name='+htmlvar+']').prop('required',true);
136+
}
137+
} else if (res.data && typeof res.data == 'object' && res.data.message) {
138+
$this.parent(".uwp_file_preview_wrap").append('<div class="uwp-field-error">' + res.data.message + '</div>');
130139
}
131140
}
132141
});

0 commit comments

Comments
 (0)