Headline
CVE-2022-4940: Changeset 2632641 for wc-multivendor-membership – WordPress Plugin Repository
The WCFM Membership plugin for WordPress is vulnerable to unauthorized modification and access of data in versions up to, and including, 2.10.0 due to missing capability checks on various AJAX actions. This makes it possible for unauthenticated attackers to perform a wide variety of actions such as modifying membership details, changing renewal information, controlling membership approvals, and more.
1 jQuery(document).ready(function($){if($(“.country_select”).length>0){$(“.country_select”).select2()} 2 if($(“.wcfm_multi_select”).length>0){$(“.wcfm_multi_select”).select2({placeholder:wcfm_registration_params.choose_select2+’ …’})} 3 if($(‘.wcfm_email_verified_input’).length>0){$(‘#user_email’).on('blur’,function(){sendEmailVerificationCode()});$(‘.wcfm_email_verified_button’).on('click’,function(e){e.preventDefault();sendEmailVerificationCode();return!1})} 4 function sendEmailVerificationCode(){$(‘#user_email’).block({message:null,overlayCSS:{background:’#fff’,opacity:0.6}});$is_valid=!0;if($is_valid){$user_email=$(‘#user_email’).val();if(!$user_email){$(‘#user_email’).removeClass(‘wcfm_validation_success’).addClass(‘wcfm_validation_failed’);$('#wcfm_membership_container .wcfm-message:not(.email_verification_message, .sms_verification_message)').html('<span class="wcicon-status-cancelled"></span>’+$(‘#user_email’).data(‘required_message’)).addClass(‘wcfm-error’).slideDown();$is_valid=!1}else{$(‘#user_email’).addClass(‘wcfm_validation_success’).removeClass(‘wcfm_validation_failed’)}} 5 if($is_valid){var data={action:’wcfmvm_email_verification_code’,user_email:$(‘#user_email’).val()} 6 $.post(wcfm_params.ajax_url,data,function(response){if(response){$response_json=$.parseJSON(response);if($response_json.status){$(‘.wcfm-message’).html(‘’).removeClass(‘wcfm-error’).slideUp();$(‘#wcfm_membership_registration_form .email_verification_message’).html('<span class="wcicon-status-completed"></span>’+$response_json.message).addClass(‘wcfm-success’).slideDown()}else{$(‘.wcfm-message’).html(‘’).removeClass(‘wcfm-success’).slideUp();$(‘#wcfm_membership_registration_form .email_verification_message’).html('<span class="wcicon-status-cancelled"></span>’+$response_json.message).addClass(‘wcfm-error’).slideDown()} 7 $(‘#user_email’).unblock()}})}else{$(‘#user_email’).unblock()}} 8 if($(‘.wcfm_sms_verified_input’).length>0){$(‘#user_phone’).on('blur’,function(){sendSMSVerificationCode()});$(‘.wcfm_sms_verified_button’).on('click’,function(e){e.preventDefault();sendSMSVerificationCode();return!1})} 9 function sendSMSVerificationCode(){$(‘#user_phone’).block({message:null,overlayCSS:{background:’#fff’,opacity:0.6}});$is_valid=!0;if($is_valid){$user_phone=$(‘#user_phone’).val();if(!$user_phone){$(‘#user_phone’).removeClass(‘wcfm_validation_success’).addClass(‘wcfm_validation_failed’);$('#wcfm_membership_container .wcfm-message:not(.email_verification_message, .sms_verification_message)').html('<span class="wcicon-status-cancelled"></span>’+$(‘#user_phone’).data(‘required_message’)).addClass(‘wcfm-error’).slideDown();$is_valid=!1}else{$(‘#user_phone’).addClass(‘wcfm_validation_success’).removeClass(‘wcfm_validation_failed’)}} 10 if($is_valid){var data={action:’wcfmvm_sms_verification_code’,user_phone:$(‘#user_phone’).val()} 11 $.post(wcfm_params.ajax_url,data,function(response){if(response){$response_json=$.parseJSON(response);if($response_json.status){$(‘.wcfm-message’).html(‘’).removeClass(‘wcfm-error’).slideUp();$(‘#wcfm_membership_registration_form .sms_verification_message’).html('<span class="wcicon-status-completed"></span>’+$response_json.message).addClass(‘wcfm-success’).slideDown()}else{$(‘.wcfm-message’).html(‘’).removeClass(‘wcfm-success’).slideUp();$(‘#wcfm_membership_registration_form .sms_verification_message’).html('<span class="wcicon-status-cancelled"></span>’+$response_json.message).addClass(‘wcfm-error’).slideDown()} 12 $(‘#user_phone’).unblock()}})}else{$(‘#user_phone’).unblock()}} 13 function unwrapSelect(){$(‘#wcfm-main-contentainer’).find(‘input[type="checkbox"]').each(function(){if($(this).parent().hasClass(“icheckbox_minimal”)){$(this).iCheck(‘destroy’)} 14 if($(this).parent().is(“span”)){$(this).unwrap(“span”)} 15 if($(this).parent().is(“label”)){$(this).unwrap(“label”)}});$(‘#wcfm-main-contentainer’).find(‘select’).each(function(){if($(this).parent().is(“span”)){$(this).unwrap(“span”)} 16 if($(this).parent().is(“label”)){$(this).unwrap(“label”)} 17 if($(this).parent().hasClass(“select-option”)||$(this).parent().hasClass(“buddyboss-select-inner”)||$(this).parent().hasClass(“buddyboss-select”)){$(this).parent().find(‘.ti-angle-down’).remove();$(this).parent().find(‘span’).remove();$(this).unwrap(“div”)}});setTimeout(function(){unwrapSelect()},500)} 18 function restrictNameInput(){$(‘.wcfm_name_input’).each(function(){$(this).on(“contextmenu",function(){return!1});$(this).on('keydown’,function(e){if(!((e.keyCode>95&&e.keyCode<106)||(e.keyCode>47&&e.keyCode<58)||(e.keyCode>64&&e.keyCode<91)||e.keyCode==8||e.keyCode==9||e.keyCode==32||e.keyCode==37||e.keyCode==39||e.keyCode==46||e.keyCode==189)){return!1}})});setTimeout(function(){restrictNameInput()},500)} 19 setTimeout(function(){$(‘#wcfm-main-contentainer’).find(‘select’).each(function(){if($(this).parent().is(“span”)||$(this).parent().is(“label”)){$(this).css(‘padding’,’5px’).css(‘min-width’,’15px’).css(‘min-height’,’35px’).css(‘padding-top’,’5px’).css(‘padding-right’,’5px’)}});unwrapSelect();restrictNameInput()},500);if($(‘.wcfm_store_slug_verified’).length>0){$(‘#store_name’).on('blur’,function(){checkStoreSlug()});function checkStoreSlug(){$(‘#store_name’).block({message:null,overlayCSS:{background:’#fff’,opacity:0.6}});$is_valid=!0;if($is_valid){$store_name=$(‘#store_name’).val();if(!$store_name){$(‘#store_name’).removeClass(‘wcfm_validation_success’).addClass(‘wcfm_validation_failed’);$('#wcfm_membership_container .wcfm-message:not(.email_verification_message, .sms_verification_message)').html('<span class="wcicon-status-cancelled"></span>’+$(‘#store_name’).data(‘required_message’)).addClass(‘wcfm-error’).slideDown();$is_valid=!1}else{$(‘#store_name’).addClass(‘wcfm_validation_success’).removeClass(‘wcfm_validation_failed’)}} 20 if($is_valid){var data={action:’wcfmvm_store_slug_verification’,store_name:$(‘#store_name’).val()} 21 $.post(wcfm_params.ajax_url,data,function(response){if(response){$response_json=$.parseJSON(response);$(‘.wcfm_store_slug_status’).remove();$(‘.wcfm-message’).html(‘’).removeClass(‘wcfm-error’).slideUp();if($response_json.status){$(‘#store_name’).addClass(‘wcfm_validation_success’).removeClass(‘wcfm_validation_failed’);$(‘.wcfm_store_slug’).text(decodeURIComponent($response_json.store_slug));$(‘.wcfm_store_slug_verified’).append('<span class="wcfm_store_slug_status"><span class="wcicon-status-completed"></span> ‘+$(‘.wcfm_store_slug_verified’).data(‘avail’)+’</span>’)}else{$(‘#store_name’).removeClass(‘wcfm_validation_success’).addClass(‘wcfm_validation_failed’);$(‘.wcfm_store_slug’).text('[‘+wcfm_registration_params.your_store+’]');$(‘.wcfm_store_slug_verified’).append('<span class="wcfm_store_slug_status” style="color: red;"><span class="wcicon-status-cancelled"></span> ‘+$(‘.wcfm_store_slug_verified’).data(‘unavail’)+’</span>’)} 22 $(‘#store_name’).unblock()}})}else{$(‘#store_name’).unblock()}}} 23 function setStateBoxforCountry(countryBox){var states_json=wc_country_select_params.countries.replace(/"/g,’"’),states=$.parseJSON(states_json),country=countryBox.val();if(states[country]){if($.isEmptyObject(states[country])){countryBox.parent().find(‘.wcfmvm_state_to_select’).each(function(){$statebox=$(this);$statebox_id=$statebox.attr(‘id’);$statebox_name=$statebox.attr(‘name’);$statebox_val=$statebox.val();$statebox_dataname=$statebox.data(‘name’);if($statebox_val==null)$statebox_val=’’;if($statebox.is(‘select’)){$statebox.replaceWith(‘<input type="text" name="’+$statebox_name+’" id="’+$statebox_id+’" data-name="’+$statebox_dataname+’" value="’+$statebox_val+’" class="wcfm-text wcfmvm_state_to_select" />’)}})}else{input_selected_state=’’;var options=’’,state=states[country];countryBox.parent().find(‘.wcfmvm_state_to_select’).each(function(){$statebox=$(this);$statebox_id=$statebox.attr(‘id’);$statebox_name=$statebox.attr(‘name’);$statebox_val=$statebox.val();$statebox_dataname=$statebox.data(‘name’);if($statebox_val==null)$statebox_val=’’;for(var index in state){if(state.hasOwnProperty(index)){if($statebox_val){if($statebox_val==index){var selected_value=’selected="selected"’}else{var selected_value=’’}} 24 options=options+’<option value="’+index+’"’+selected_value+’>’+state[index]+’</option>’}} 25 if($statebox.is(‘select’)){$statebox.html('<option value="">’+wc_country_select_params.i18n_select_state_text+’</option>’+options)} 26 if($statebox.is(‘input’)){$statebox.replaceWith(‘<select name="’+$statebox_name+’" id="’+$statebox_id+’" data-name="’+$statebox_dataname+’" class="wcfm-select wcfmvm_state_to_select"></select>’);$statebox=$('#’+$statebox_id);$statebox.html('<option value="">’+wc_country_select_params.i18n_select_state_text+’</option>’+options)} 27 $statebox.val($statebox_val)})}}else{countryBox.parent().find(‘.wcfmvm_state_to_select’).each(function(){$statebox=$(this);$statebox_id=$statebox.attr(‘id’);$statebox_name=$statebox.attr(‘name’);$statebox_val=$statebox.val();$statebox_dataname=$statebox.data(‘name’);if($statebox_val==null)$statebox_val=’’;if($statebox.is(‘select’)){$statebox.replaceWith(‘<input type="text" name="’+$statebox_name+’" id="’+$statebox_id+’" data-name="’+$statebox_dataname+’" value="’+$statebox_val+’" class="wcfm-text wcfmvm_state_to_select" />’)}})}} 28 $(‘.wcfmvm_country_to_select’).each(function(){$(this).change(function(){setStateBoxforCountry($(this))}).change()});$(‘#passoword’).keyup(function(){if(wcfm_registration_params.is_strength_check){checkStrength($(‘#passoword’).val())}});function checkStrength(password){var strength=0 29 if(password.length<6){$(‘#password_strength’).removeClass();$(‘#password_strength’).addClass(‘short’) 30 $(‘#password_strength’).html(wcfm_registration_params.short);return’short’} 31 if(password.length>7)strength+=1 32 if(password.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/))strength+=1 33 if(password.match(/([a-zA-Z])/)&&password.match(/([0-9])/))strength+=1 34 if(password.match(/([!,%,&,@,#,$,^,*,?,_,~])/))strength+=1 35 if(password.match(/(.*[!,%,&,@,#,$,^,*,?,_,~].*[!,%,&,@,#,$,^,*,?,_,~])/))strength+=1 36 if(strength<2){$(‘#password_strength’).removeClass() 37 $(‘#password_strength’).addClass(‘weak’) 38 $(‘#password_strength’).html(wcfm_registration_params.weak);return’weak’}else if(strength==2){$(‘#password_strength’).removeClass() 39 $(‘#password_strength’).addClass(‘good’) 40 $(‘#password_strength’).html(wcfm_registration_params.good);return’good’}else{$(‘#password_strength’).removeClass() 41 $(‘#password_strength’).addClass(‘strong’) 42 $(‘#password_strength’).html(wcfm_registration_params.strong);return’strong’}} 43 $wcfm_anr_loaded=!1;if(jQuery(‘.anr_captcha_field’).length>0){var wcfmvm_anr_onloadCallback=function(){var anr_obj={’sitekey’:wcfm_registration_captcha_params.site_key,’size’:wcfm_registration_captcha_params.size,};if('invisible’==wcfm_registration_captcha_params.size){anr_obj.badge=wcfm_registration_captcha_params.badge}else{anr_obj.theme=wcfm_registration_captcha_params.theme} 44 var anr_captcha99;if('invisible’==wcfm_registration_captcha_params.size){var anr_form99=jQuery(‘#anr_captcha_field_99’).closest(‘form’)[0];anr_obj.callback=function(){anr_form99.submit()};anr_obj[“expired-callback”]=function(){grecaptcha.reset(anr_captcha99)};anr_form99.onsubmit=function(evt){evt.preventDefault();grecaptcha.execute(anr_captcha99)}} 45 anr_captcha_99=grecaptcha.render(‘anr_captcha_field_99’,anr_obj)};setTimeout(function(){if(typeof grecaptcha!="undefined"){wcfmvm_anr_onloadCallback();$wcfm_anr_loaded=!0}else{setTimeout(function(){if(typeof grecaptcha!="undefined"){wcfmvm_anr_onloadCallback();$wcfm_anr_loaded=!0}},1000)}},1000)} 46 $(‘#wcfm_membership_register_button’).click(function(event){event.preventDefault();$(‘.wcfm-message’).html(‘’).removeClass(‘wcfm-error’).removeClass(‘wcfm-success’).slideUp();$wcfm_is_valid_form=!0;$(document.body).trigger(‘wcfm_form_validate’,$(‘#wcfm_membership_registration_form’));$is_valid=$wcfm_is_valid_form;if($is_valid){$password=$(‘#passoword’).val();if($password&&wcfm_registration_params.is_strength_check){$password_strength=checkStrength($password);if(($password_strength==’short’)||($password_strength==’weak’)){$(‘#passoword’).removeClass(‘wcfm_validation_success’).addClass(‘wcfm_validation_failed’);$('#wcfm_membership_container .wcfm-message:not(.email_verification_message, .sms_verification_message)').html('<span class="wcicon-status-cancelled"></span>’+wcfm_registration_params.password_failed).addClass(‘wcfm-error’).slideDown();$is_valid=!1}}} 47 if($is_valid){$password=$(‘#passoword’).val();$confirm_pwd=$(‘#confirm_pwd’).val();if($password!=$confirm_pwd){$(‘#passoword’).removeClass(‘wcfm_validation_success’).addClass(‘wcfm_validation_failed’);$(‘#confirm_pwd’).removeClass(‘wcfm_validation_success’).addClass(‘wcfm_validation_failed’);$('#wcfm_membership_container .wcfm-message:not(.email_verification_message, .sms_verification_message)').html('<span class="wcicon-status-cancelled"></span>’+$(‘#passoword’).data(‘mismatch_message’)).addClass(‘wcfm-error’).slideDown();$is_valid=!1}} 48 $(‘#wcfm_membership_container’).block({message:null,overlayCSS:{background:’#fff’,opacity:0.6}});if($is_valid){$form_data=new FormData(document.getElementById(‘wcfm_membership_registration_form’));$form_data.append('wcfm_membership_registration_form’,$(‘#wcfm_membership_registration_form’).serialize());$form_data.append(‘action’,’wcfm_ajax_controller’);$form_data.append(‘controller’,’wcfm-memberships-registration’);$.ajax({type:’POST’,url:wcfm_params.ajax_url,data:$form_data,contentType:!1,cache:!1,processData:!1,success:function(response){if(response){$response_json=$.parseJSON(response);if($response_json.status){$('#wcfm_membership_registration_form .wcfm-message:not(.email_verification_message, .sms_verification_message)').html('<span class="wcicon-status-completed"></span>’+$response_json.message).addClass(‘wcfm-success’).slideDown(“slow",function(){if($response_json.redirect)window.location=$response_json.redirect})}else{$(‘.wcfm-message’).html(‘’).removeClass(‘wcfm-success’).slideUp();$('#wcfm_membership_registration_form .wcfm-message:not(.email_verification_message, .sms_verification_message)').html('<span class="wcicon-status-cancelled"></span>’+$response_json.message).addClass(‘wcfm-error’).slideDown()} 49 if(jQuery(‘.anr_captcha_field’).length>0){if(typeof grecaptcha!="undefined”){if($wcfm_anr_loaded){grecaptcha.reset()}else{wcfmvm_anr_onloadCallback()}}} 50 $(‘#wcfm_membership_container’).unblock()}}})}else{if(jQuery(‘.anr_captcha_field’).length>0){if(typeof grecaptcha!="undefined"){if($wcfm_anr_loaded){grecaptcha.reset()}else{wcfmvm_anr_onloadCallback()}}} 51 $(‘#wcfm_membership_container’).unblock()}})}) 1jQuery(document).ready(function(e){function s(){if(e(“#user_email”).block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),$is_valid=!0,$is_valid&&($user_email=e(“#user_email”).val(),$user_email?e(“#user_email”).addClass(“wcfm_validation_success”).removeClass(“wcfm_validation_failed”):(e(“#user_email”).removeClass(“wcfm_validation_success”).addClass(“wcfm_validation_failed”),e(“#wcfm_membership_container .wcfm-message:not(.email_verification_message, .sms_verification_message)").html('<span class="wcicon-status-cancelled"></span>’+e(“#user_email”).data(“required_message”)).addClass(“wcfm-error”).slideDown(),$is_valid=!1)),$is_valid){var s={action:"wcfmvm_email_verification_code",user_email:e(“#user_email”).val(),wcfm_ajax_nonce:wcfm_params.wcfm_ajax_nonce};e.post(wcfm_params.ajax_url,s,function(s){s&&($response_json=e.parseJSON(s),$response_json.status?(e(“.wcfm-message”).html(“”).removeClass(“wcfm-error”).slideUp(),e(“#wcfm_membership_registration_form .email_verification_message”).html('<span class="wcicon-status-completed"></span>’+$response_json.message).addClass(“wcfm-success”).slideDown()):(e(“.wcfm-message”).html(“”).removeClass(“wcfm-success”).slideUp(),e(“#wcfm_membership_registration_form .email_verification_message”).html(‘<span class="wcicon-status-cancelled"></span>’+$response_json.message).addClass(“wcfm-error”).slideDown()),e(“#user_email”).unblock())})}else e(“#user_email”).unblock()}function a(){if(e(“#user_phone”).block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),$is_valid=!0,$is_valid&&($user_phone=e(“#user_phone”).val(),$user_phone?e(“#user_phone”).addClass(“wcfm_validation_success”).removeClass(“wcfm_validation_failed”):(e(“#user_phone”).removeClass(“wcfm_validation_success”).addClass(“wcfm_validation_failed”),e(“#wcfm_membership_container .wcfm-message:not(.email_verification_message, .sms_verification_message)").html('<span class="wcicon-status-cancelled"></span>’+e(“#user_phone”).data(“required_message”)).addClass(“wcfm-error”).slideDown(),$is_valid=!1)),$is_valid){var s={action:"wcfmvm_sms_verification_code",user_phone:e(“#user_phone”).val(),wcfm_ajax_nonce:wcfm_params.wcfm_ajax_nonce};e.post(wcfm_params.ajax_url,s,function(s){s&&($response_json=e.parseJSON(s),$response_json.status?(e(“.wcfm-message”).html(“”).removeClass(“wcfm-error”).slideUp(),e(“#wcfm_membership_registration_form .sms_verification_message”).html('<span class="wcicon-status-completed"></span>’+$response_json.message).addClass(“wcfm-success”).slideDown()):(e(“.wcfm-message”).html(“”).removeClass(“wcfm-success”).slideUp(),e(“#wcfm_membership_registration_form .sms_verification_message”).html('<span class="wcicon-status-cancelled"></span>’+$response_json.message).addClass(“wcfm-error”).slideDown()),e(“#user_phone”).unblock())})}else e(“#user_phone”).unblock()}if(e(“.country_select”).length>0&&e(“.country_select”).select2(),e(“.wcfm_multi_select”).length>0&&e(“.wcfm_multi_select”).select2({placeholder:wcfm_registration_params.choose_select2+” …"}),e(“.wcfm_email_verified_input”).length>0&&(e(“#user_email”).on(“blur",function(){s()}),e(“.wcfm_email_verified_button”).on(“click",function(e){return e.preventDefault(),s(),!1})),e(“.wcfm_sms_verified_input”).length>0&&(e(“#user_phone”).on(“blur",function(){a()}),e(“.wcfm_sms_verified_button”).on(“click",function(e){return e.preventDefault(),a(),!1})),setTimeout(function(){e(“#wcfm-main-contentainer”).find(“select”).each(function(){(e(this).parent().is(“span”)||e(this).parent().is(“label”))&&e(this).css(“padding","5px”).css(“min-width","15px”).css(“min-height","35px”).css(“padding-top","5px”).css(“padding-right","5px”)}),function s(){e(“#wcfm-main-contentainer”).find('input[type="checkbox”]').each(function(){e(this).parent().hasClass(“icheckbox_minimal”)&&e(this).iCheck(“destroy”),e(this).parent().is(“span”)&&e(this).unwrap(“span”),e(this).parent().is(“label”)&&e(this).unwrap(“label”)}),e(“#wcfm-main-contentainer”).find(“select”).each(function(){e(this).parent().is(“span”)&&e(this).unwrap(“span”),e(this).parent().is(“label”)&&e(this).unwrap(“label”),(e(this).parent().hasClass(“select-option”)||e(this).parent().hasClass(“buddyboss-select-inner”)||e(this).parent().hasClass(“buddyboss-select”))&&(e(this).parent().find(“.ti-angle-down”).remove(),e(this).parent().find(“span”).remove(),e(this).unwrap(“div”))}),setTimeout(function(){s()},500)}(),function s(){e(“.wcfm_name_input”).each(function(){e(this).on(“contextmenu",function(){return!1}),e(this).on(“keydown",function(e){if(!(e.keyCode>95&&e.keyCode<106||e.keyCode>47&&e.keyCode<58||e.keyCode>64&&e.keyCode<91||8==e.keyCode||9==e.keyCode||32==e.keyCode||37==e.keyCode||39==e.keyCode||46==e.keyCode||189==e.keyCode))return!1})}),setTimeout(function(){s()},500)}()},500),e(“.wcfm_store_slug_verified”).length>0){e(“#store_name”).on(“blur",function(){!function(){e(“#store_name”).block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),$is_valid=!0,$is_valid&&($store_name=e(“#store_name”).val(),$store_name?e(“#store_name”).addClass(“wcfm_validation_success”).removeClass(“wcfm_validation_failed”):(e(“#store_name”).removeClass(“wcfm_validation_success”).addClass(“wcfm_validation_failed”),e(“#wcfm_membership_container .wcfm-message:not(.email_verification_message, .sms_verification_message)").html('<span class="wcicon-status-cancelled"></span>’+e(“#store_name”).data(“required_message”)).addClass(“wcfm-error”).slideDown(),$is_valid=!1));if($is_valid){var s={action:"wcfmvm_store_slug_verification",store_name:e(“#store_name”).val(),wcfm_ajax_nonce:wcfm_params.wcfm_ajax_nonce};e.post(wcfm_params.ajax_url,s,function(s){s&&($response_json=e.parseJSON(s),e(“.wcfm_store_slug_status”).remove(),e(“.wcfm-message”).html(“”).removeClass(“wcfm-error”).slideUp(),$response_json.status?(e(“#store_name”).addClass(“wcfm_validation_success”).removeClass(“wcfm_validation_failed”),e(“.wcfm_store_slug”).text(decodeURIComponent($response_json.store_slug)),e(“.wcfm_store_slug_verified”).append('<span class="wcfm_store_slug_status"><span class="wcicon-status-completed"></span> '+e(“.wcfm_store_slug_verified”).data(“avail”)+"</span>”)):(e(“#store_name”).removeClass(“wcfm_validation_success”).addClass(“wcfm_validation_failed”),e(“.wcfm_store_slug”).text("[“+wcfm_registration_params.your_store+”]"),e(“.wcfm_store_slug_verified”).append('<span class="wcfm_store_slug_status” style="color: red;"><span class="wcicon-status-cancelled"></span> '+e(“.wcfm_store_slug_verified”).data(“unavail”)+"</span>”)),e(“#store_name”).unblock())})}else e(“#store_name”).unblock()}()})}function t(s){var a=0;return s.length<6?(e(“#password_strength”).removeClass(),e(“#password_strength”).addClass(“short”),e(“#password_strength”).html(wcfm_registration_params.short),"short”):(s.length>7&&(a+=1),s.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)&&(a+=1),s.match(/([a-zA-Z])/)&&s.match(/([0-9])/)&&(a+=1),s.match(/([!,%,&,@,#,$,^,*,?,_,~])/)&&(a+=1),s.match(/(.*[!,%,&,@,#,$,^,*,?,_,~].*[!,%,&,@,#,$,^,*,?,_,~])/)&&(a+=1),a<2?(e(“#password_strength”).removeClass(),e(“#password_strength”).addClass(“weak”),e(“#password_strength”).html(wcfm_registration_params.weak),"weak”):2==a?(e(“#password_strength”).removeClass(),e(“#password_strength”).addClass(“good”),e(“#password_strength”).html(wcfm_registration_params.good),"good”):(e(“#password_strength”).removeClass(),e(“#password_strength”).addClass(“strong”),e(“#password_strength”).html(wcfm_registration_params.strong),"strong”))}if(e(“.wcfmvm_country_to_select”).each(function(){e(this).change(function(){!function(s){var a=wc_country_select_params.countries.replace(/"/g,’"’),t=e.parseJSON(a),n=s.val();if(t[n])if(e.isEmptyObject(t[n]))s.parent().find(“.wcfmvm_state_to_select”).each(function(){$statebox=e(this),$statebox_id=$statebox.attr(“id”),$statebox_name=$statebox.attr(“name”),$statebox_val=$statebox.val(),$statebox_dataname=$statebox.data(“name”),null==$statebox_val&&($statebox_val="”),$statebox.is(“select”)&&$statebox.replaceWith(‘<input type="text" name="’+$statebox_name+’" id="’+$statebox_id+’" data-name="’+$statebox_dataname+’" value="’+$statebox_val+’" class="wcfm-text wcfmvm_state_to_select" />’)});else{input_selected_state="";var o="",i=t[n];s.parent().find(“.wcfmvm_state_to_select”).each(function(){for(var s in $statebox=e(this),$statebox_id=$statebox.attr(“id”),$statebox_name=$statebox.attr(“name”),$statebox_val=$statebox.val(),$statebox_dataname=$statebox.data(“name”),null==$statebox_val&&($statebox_val=""),i)if(i.hasOwnProperty(s)){if($statebox_val)if($statebox_val==s)var a=’selected="selected"’;else a="";o=o+’<option value="’+s+’"’+a+">"+i[s]+"</option>"}$statebox.is(“select”)&&$statebox.html('<option value="">’+wc_country_select_params.i18n_select_state_text+"</option>"+o),$statebox.is(“input”)&&($statebox.replaceWith(‘<select name="’+$statebox_name+’" id="’+$statebox_id+’" data-name="’+$statebox_dataname+’" class="wcfm-select wcfmvm_state_to_select"></select>’),$statebox=e(“#"+$statebox_id),$statebox.html('<option value="">’+wc_country_select_params.i18n_select_state_text+"</option>"+o)),$statebox.val($statebox_val)})}else s.parent().find(“.wcfmvm_state_to_select”).each(function(){$statebox=e(this),$statebox_id=$statebox.attr(“id”),$statebox_name=$statebox.attr(“name”),$statebox_val=$statebox.val(),$statebox_dataname=$statebox.data(“name”),null==$statebox_val&&($statebox_val="”),$statebox.is(“select”)&&$statebox.replaceWith(‘<input type="text" name="’+$statebox_name+’" id="’+$statebox_id+’" data-name="’+$statebox_dataname+’" value="’+$statebox_val+’" class="wcfm-text wcfmvm_state_to_select" />’)})}(e(this))}).change()}),e(“#passoword”).keyup(function(){wcfm_registration_params.is_strength_check&&t(e(“#passoword”).val())}),$wcfm_anr_loaded=!1,jQuery(“.anr_captcha_field”).length>0){var n=function(){var e={sitekey:wcfm_registration_captcha_params.site_key,size:wcfm_registration_captcha_params.size};if("invisible"==wcfm_registration_captcha_params.size?e.badge=wcfm_registration_captcha_params.badge:e.theme=wcfm_registration_captcha_params.theme,"invisible"==wcfm_registration_captcha_params.size){var s=jQuery(“#anr_captcha_field_99”).closest(“form”)[0];e.callback=function(){s.submit()},e[“expired-callback”]=function(){grecaptcha.reset(void 0)},s.onsubmit=function(e){e.preventDefault(),grecaptcha.execute(void 0)}}anr_captcha_99=grecaptcha.render("anr_captcha_field_99",e)};setTimeout(function(){"undefined"!=typeof grecaptcha?(n(),$wcfm_anr_loaded=!0):setTimeout(function(){"undefined"!=typeof grecaptcha&&(n(),$wcfm_anr_loaded=!0)},1e3)},1e3)}e(“#wcfm_membership_register_button”).click(function(s){s.preventDefault(),e(“.wcfm-message”).html(“”).removeClass(“wcfm-error”).removeClass(“wcfm-success”).slideUp(),$wcfm_is_valid_form=!0,e(document.body).trigger("wcfm_form_validate",e(“#wcfm_membership_registration_form”)),$is_valid=$wcfm_is_valid_form,$is_valid&&($password=e(“#passoword”).val(),$password&&wcfm_registration_params.is_strength_check&&($password_strength=t($password),"short"!=$password_strength&&"weak"!=$password_strength||(e(“#passoword”).removeClass(“wcfm_validation_success”).addClass(“wcfm_validation_failed”),e("#wcfm_membership_container .wcfm-message:not(.email_verification_message, .sms_verification_message)").html('<span class="wcicon-status-cancelled"></span>’+wcfm_registration_params.password_failed).addClass(“wcfm-error”).slideDown(),$is_valid=!1))),$is_valid&&($password=e(“#passoword”).val(),$confirm_pwd=e(“#confirm_pwd”).val(),$password!=$confirm_pwd&&(e(“#passoword”).removeClass(“wcfm_validation_success”).addClass(“wcfm_validation_failed”),e(“#confirm_pwd”).removeClass(“wcfm_validation_success”).addClass(“wcfm_validation_failed”),e("#wcfm_membership_container .wcfm-message:not(.email_verification_message, .sms_verification_message)").html('<span class="wcicon-status-cancelled"></span>’+e(“#passoword”).data(“mismatch_message”)).addClass(“wcfm-error”).slideDown(),$is_valid=!1)),e(“#wcfm_membership_container”).block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),$is_valid?($form_data=new FormData(document.getElementById(“wcfm_membership_registration_form”)),$form_data.append("wcfm_membership_registration_form",e(“#wcfm_membership_registration_form”).serialize()),$form_data.append(“action","wcfm_ajax_controller”),$form_data.append(“controller","wcfm-memberships-registration”),$form_data.append("wcfm_ajax_nonce",wcfm_params.wcfm_ajax_nonce),e.ajax({type:"POST",url:wcfm_params.ajax_url,data:$form_data,contentType:!1,cache:!1,processData:!1,success:function(s){s&&($response_json=e.parseJSON(s),$response_json.status?e("#wcfm_membership_registration_form .wcfm-message:not(.email_verification_message, .sms_verification_message)").html('<span class="wcicon-status-completed"></span>’+$response_json.message).addClass(“wcfm-success”).slideDown("slow",function(){$response_json.redirect&&(window.location=$response_json.redirect)}):(e(“.wcfm-message”).html(“”).removeClass(“wcfm-success”).slideUp(),e("#wcfm_membership_registration_form .wcfm-message:not(.email_verification_message, .sms_verification_message)").html('<span class="wcicon-status-cancelled"></span>’+$response_json.message).addClass(“wcfm-error”).slideDown()),jQuery(“.anr_captcha_field”).length>0&&"undefined"!=typeof grecaptcha&&($wcfm_anr_loaded?grecaptcha.reset():n()),e(“#wcfm_membership_container”).unblock())}})):(jQuery(“.anr_captcha_field”).length>0&&"undefined"!=typeof grecaptcha&&($wcfm_anr_loaded?grecaptcha.reset():n()),e(“#wcfm_membership_container”).unblock())})});