if( jQuery('.mec-wrap').hasClass('mec-modal-wrap')){
jQuery('.mec-login-input #email, .mec-login-input #password').keypress(function(e)
{
var key = e.which;
if(key === 13) // the enter key code
{
jQuery('.mec-login-form-footer button').click();
return false;
}
});
jQuery(".mec-login-form-footer button").on('click', function(e)
{
e.preventDefault();
var mec_email = jQuery(".mec-login-form #email").val(),
mec_pass = jQuery(".mec-login-form #password").val(),
mec_nonce = jQuery(".mec-login-form #mec_login_nonce").val(),
cf_turnstile_response = jQuery('input[name="cf-turnstile-response"]').val();
jQuery.ajax(
{
url: 'https://www.dataiq.global/wp-admin/admin-ajax.php',
type: 'post',
data: {
action: 'mec_ajax_login_data',
username: mec_email,
password : mec_pass,
mec_login_nonce : mec_nonce,
"cf-turnstile-response" : cf_turnstile_response,
},
beforeSend: function(message)
{
jQuery(".mec-login-form").append("
");
},
success: function(data)
{
var message = jQuery.parseJSON(data);
jQuery(".mec-ajax-login-loading").append("
");
if(!message.loggedin)
{
jQuery(".mec-ajax-login-loading .lds-ripple").remove();
jQuery(".mec-ajax-login-loading-text").addClass('error').append(message.message);
setTimeout(() => {
location.reload();
}, 1000);
}
else
{
jQuery(".mec-ajax-login-loading-text").addClass('success').append(message.message);
setTimeout(() => {
location.reload();
}, 1000);
}
}
});
});
}