Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/wordfenc.../modules/login-se.../js
File: login.1722265817.js
(function($) {
[0] Fix | Delete
function __(string) {
[1] Fix | Delete
return WFLS_LOGIN_TRANSLATIONS[string] || string;
[2] Fix | Delete
}
[3] Fix | Delete
!function(Z){"use strict";Z.Zebra_Tooltips=function(t,l){var u,T,b,v,n={animation_speed:250,animation_offset:20,close_on_click:!0,content:!(this.version="2.1.0"),hide_delay:100,keep_visible:!0,max_width:250,opacity:".95",position:"center",prerender:!1,show_delay:100,vertical_alignment:"above",vertical_offset:0,onBeforeHide:null,onHide:null,onBeforeShow:null,onShow:null},r=this,_=function(e){var t,o,i,a,l,n,r,_,s,p,d,h,c,f,w=e.data("Zebra_Tooltip"),m=Z(window);return w.tooltip||(t=Z("<div>",{"class":"Zebra_Tooltip",css:{opacity:0,display:"block"}}),o=Z("<div>",{"class":"Zebra_Tooltip_Message",css:{maxWidth:w.max_width}}).html(w.content).appendTo(t),i=Z("<div>",{"class":"Zebra_Tooltip_Arrow"}).appendTo(t),a=Z("<div>").addClass("Zebra_Tooltip_Arrow_Border").appendTo(i),Z("<div>").appendTo(i),w.keep_visible&&(t.on("mouseleave"+(w.close_on_click?" click":""),function(){y(e)}),t.on("mouseenter",function(){g(e)})),t.appendTo("body"),w.sticky&&o.addClass("Zebra_Tooltip_Has_Close"),l=t.outerWidth(),n=t.outerHeight(),r=a.outerWidth(),_=a.outerHeight(),s=o.outerWidth(),p=o.outerHeight(),w={tooltip:t,tooltip_width:l,tooltip_height:n+_/2,message:o,arrow_container:i,arrow_width:r,arrow_height:_,arrow:a},t.css({width:w.tooltip_width,height:w.tooltip_height}),w.tooltip_width=w.tooltip_width+(o.outerWidth()-s),w.tooltip_height=w.tooltip_height+(o.outerHeight()-p),t.css({width:w.tooltip_width,height:w.tooltip_height,display:"none"}),w=Z.extend(e.data("Zebra_Tooltip"),w),e.data("Zebra_Tooltip",w)),w.sticky&&!w.close&&(Z("<a>",{"class":"Zebra_Tooltip_Close",href:"javascript:void(0)"}).html("&times;").on("click",function(t){t.preventDefault();var o=e.data("Zebra_Tooltip");o.sticky=!1,e.data("Zebra_Tooltip",o),y(e)}).appendTo(w.message),w.close=!0,w=Z.extend(e.data("Zebra_Tooltip"),w),e.data("Zebra_Tooltip",w)),u=m.width(),T=m.height(),d=e.offset(),Z.extend(w,{element_left:d.left,element_top:d.top,element_width:e.outerWidth(),element_height:e.outerHeight()}),v=m.scrollTop(),b=m.scrollLeft(),h="left"===w.position?w.element_left-w.tooltip_width+w.arrow_width:"right"===w.position?w.element_left+w.element_width-w.arrow_width:w.element_left+(w.element_width-w.tooltip_width)/2,c=w.element_top-w.tooltip_height,f="left"===w.position?w.tooltip_width-w.arrow_width-w.arrow_width/2:"right"===w.position?w.arrow_width/2:(w.tooltip_width-w.arrow_width)/2,h+w.tooltip_width>u+b&&(f-=u+b-(h+w.tooltip_width)-6,h=u+b-w.tooltip_width-6,f+w.arrow_width>w.tooltip_width-6&&(f=w.tooltip_width-6-w.arrow_width),h+f+w.arrow_width/2<w.element_left&&(f=-1e4)),h<b&&(f-=b-h,h=b+2,f<0&&(f=w.arrow_width/2),h+f+w.arrow_width/2>w.element_left+w.element_width&&(f=-1e4)),w.message.css("margin-top",""),w.arrow_container.removeClass("Zebra_Tooltip_Arrow_Top").addClass("Zebra_Tooltip_Arrow_Bottom"),c<v||"below"===w.vertical_alignment&&w.element_top+w.element_height+w.vertical_offset+w.tooltip_height+w.animation_offset<T+v?(c=w.element_top+w.element_height-w.vertical_offset,w.animation_offset=Math.abs(w.animation_offset),w.message.css("margin-top",w.arrow_height/2),w.arrow_container.removeClass("Zebra_Tooltip_Arrow_Bottom").addClass("Zebra_Tooltip_Arrow_Top")):(w.animation_offset=-Math.abs(w.animation_offset),c+=w.vertical_offset),w.arrow_container.css("left",f),w.tooltip.css({left:h,top:c}),Z.extend(w,{tooltip_left:h,tooltip_top:c,arrow_left:f}),w=Z.extend(e.data("Zebra_Tooltip"),w),e.data("Zebra_Tooltip",w),w},g=function(t){var o=t.data("Zebra_Tooltip");clearTimeout(o.show_timeout),o.muted||(clearTimeout(o.hide_timeout),o.show_timeout=setTimeout(function(){(o=_(t)).onBeforeShow&&"function"==typeof o.onBeforeShow&&!1===o.onBeforeShow(t,o.tooltip)||("block"!==o.tooltip.css("display")&&o.tooltip.css({top:o.tooltip_top+o.animation_offset}),o.tooltip.css("display","block"),o.tooltip.stop(),o.tooltip.animate({top:o.tooltip_top,opacity:o.opacity},o.animation_speed,function(){o.onShow&&"function"==typeof o.onShow&&o.onShow(t,o.tooltip)}))},o.show_delay))},y=function(t){var o=t.data("Zebra_Tooltip");clearTimeout(o.hide_timeout),o.sticky||(clearTimeout(o.show_timeout),o.hide_timeout=setTimeout(function(){if(o.tooltip){if(o.onBeforeHide&&"function"==typeof o.onBeforeHide&&!1===o.onBeforeHide(t,o.tooltip))return;o.close=!1,o.destroy&&(o.muted=!0),t.data("Zebra_Tooltip",o),Z("a.Zebra_Tooltip_Close",o.tooltip).remove(),o.tooltip.stop(),o.tooltip.animate({opacity:0,top:o.tooltip_top+o.animation_offset},o.animation_speed,function(){Z(this).css("display","none"),o.onHide&&"function"==typeof o.onHide&&o.onHide(t,o.tooltip)})}},o.hide_delay))};r.hide=function(t,e){t.each(function(){var t=Z(this),o=t.data("Zebra_Tooltip");o&&(o.sticky=!1,e&&(o.destroy=!0),t.data("Zebra_Tooltip",o),y(t))})},r.show=function(t,e){t.each(function(){var t=Z(this),o=t.data("Zebra_Tooltip");o&&(o.sticky=!0,o.muted=!1,e&&(o.destroy=!0),t.data("Zebra_Tooltip",o),g(t))})},t.each(function(){var t,o=Z(this),e=o.attr("title"),i=o.data(),a={};for(t in i)0===t.indexOf("ztt_")&&(t=t.replace(/^ztt\_/,""),void 0!==n[t]&&(a[t]=i["ztt_"+t]));a=Z.extend(n,r.settings,l,a),e&&(a.content=o.attr("title")),void 0!==a.content&&""!==a.content.trim()&&(o.on({mouseenter:function(){e&&Z(this).attr("title",""),g(o)},mouseleave:function(){y(o),e&&Z(this).attr("title",e)}}),o.data("Zebra_Tooltip",Z.extend({tooltip:null,show_timeout:null,hide_timeout:null,sticky:!1,destroy:!1,muted:!1},a)),a.prerender&&_(o))})}}($);
[4] Fix | Delete
[5] Fix | Delete
function selectorSearch(selectors) {
[6] Fix | Delete
var input = null;
[7] Fix | Delete
return function() {
[8] Fix | Delete
if (input !== null)
[9] Fix | Delete
return input;
[10] Fix | Delete
for (var i = 0; i < selectors.length; i++) {
[11] Fix | Delete
input = $(selectors[i]);
[12] Fix | Delete
if (input.length === 1)
[13] Fix | Delete
return input;
[14] Fix | Delete
}
[15] Fix | Delete
input = null;
[16] Fix | Delete
return input;
[17] Fix | Delete
}
[18] Fix | Delete
};
[19] Fix | Delete
function FormElementLocator(inputSelectors, extraSelectors) {
[20] Fix | Delete
var self = this;
[21] Fix | Delete
[22] Fix | Delete
if (typeof extraSelectors == 'undefined')
[23] Fix | Delete
extraSelectors = {};
[24] Fix | Delete
[25] Fix | Delete
var found = false;
[26] Fix | Delete
var input = null, form = null, extra = {};
[27] Fix | Delete
[28] Fix | Delete
var findInput = selectorSearch(inputSelectors);
[29] Fix | Delete
var search = function() {
[30] Fix | Delete
input = findInput();
[31] Fix | Delete
if (input === null)
[32] Fix | Delete
return false;
[33] Fix | Delete
form = input.closest('form');
[34] Fix | Delete
if (form.length !== 1) {
[35] Fix | Delete
form = null;
[36] Fix | Delete
return false;
[37] Fix | Delete
}
[38] Fix | Delete
for (var key in extraSelectors) {
[39] Fix | Delete
var match = form.find(extraSelectors[key]);
[40] Fix | Delete
if (match.length === 1) {
[41] Fix | Delete
extra[key] = match;
[42] Fix | Delete
}
[43] Fix | Delete
else {
[44] Fix | Delete
return false;
[45] Fix | Delete
}
[46] Fix | Delete
}
[47] Fix | Delete
return true;
[48] Fix | Delete
};
[49] Fix | Delete
this.locate = function() {
[50] Fix | Delete
if (!found)
[51] Fix | Delete
found = search();
[52] Fix | Delete
return found;
[53] Fix | Delete
};
[54] Fix | Delete
this.getInput = function() {
[55] Fix | Delete
return found ? input : null;
[56] Fix | Delete
};
[57] Fix | Delete
this.getForm = function() {
[58] Fix | Delete
return found ? form : null;
[59] Fix | Delete
};
[60] Fix | Delete
this.getExtra = function(key) {
[61] Fix | Delete
if (key in extra)
[62] Fix | Delete
return extra[key];
[63] Fix | Delete
return null;
[64] Fix | Delete
}
[65] Fix | Delete
}
[66] Fix | Delete
var loginLocator = new FormElementLocator(
[67] Fix | Delete
[
[68] Fix | Delete
'input[name=log]',
[69] Fix | Delete
'input[name=username]',
[70] Fix | Delete
'input#username[name=username]',
[71] Fix | Delete
'.woocommerce-form-login input[name=username]',
[72] Fix | Delete
'.login input[name=username]'
[73] Fix | Delete
],
[74] Fix | Delete
{
[75] Fix | Delete
password: 'input[name="pwd"],input[name=password]'
[76] Fix | Delete
}
[77] Fix | Delete
);
[78] Fix | Delete
var registrationLocator = new FormElementLocator([
[79] Fix | Delete
'input[name=user_login]',
[80] Fix | Delete
'#reg_email',
[81] Fix | Delete
'.woocommerce-form-register input[name=email]',
[82] Fix | Delete
'.register input[name=email]'
[83] Fix | Delete
]);
[84] Fix | Delete
var locators = [
[85] Fix | Delete
loginLocator,
[86] Fix | Delete
registrationLocator
[87] Fix | Delete
];
[88] Fix | Delete
function getRelevantInputs() {
[89] Fix | Delete
var inputs = $();
[90] Fix | Delete
for (var i = 0; i < locators.length; i++) {
[91] Fix | Delete
if (locators[i].locate())
[92] Fix | Delete
inputs = inputs.add(locators[i].getInput());
[93] Fix | Delete
}
[94] Fix | Delete
return inputs;
[95] Fix | Delete
}
[96] Fix | Delete
[97] Fix | Delete
var wfls_init_captcha = function(actionCallback, log) {
[98] Fix | Delete
if (typeof log === 'undefined')
[99] Fix | Delete
log = getRelevantInputs();
[100] Fix | Delete
if (typeof grecaptcha === 'object') {
[101] Fix | Delete
grecaptcha.ready(function() {
[102] Fix | Delete
grecaptcha.execute(WFLSVars.recaptchasitekey, {action: 'login'}).then(function(token) {
[103] Fix | Delete
var tokenField = $('#wfls-captcha-token');
[104] Fix | Delete
if (tokenField.length) {
[105] Fix | Delete
tokenField.val(token);
[106] Fix | Delete
}
[107] Fix | Delete
else {
[108] Fix | Delete
if (log.length) {
[109] Fix | Delete
tokenField = $('<input type="hidden" name="wfls-captcha-token" id="wfls-captcha-token" />');
[110] Fix | Delete
tokenField.val(token);
[111] Fix | Delete
log.parent().append(tokenField);
[112] Fix | Delete
}
[113] Fix | Delete
}
[114] Fix | Delete
[115] Fix | Delete
typeof actionCallback === 'function' && actionCallback(true);
[116] Fix | Delete
});
[117] Fix | Delete
});
[118] Fix | Delete
}
[119] Fix | Delete
else {
[120] Fix | Delete
var tokenField = $('#wfls-captcha-token');
[121] Fix | Delete
if (tokenField.length) {
[122] Fix | Delete
tokenField.val('grecaptcha-missing');
[123] Fix | Delete
}
[124] Fix | Delete
else {
[125] Fix | Delete
if (log.length) {
[126] Fix | Delete
tokenField = $('<input type="hidden" name="wfls-captcha-token" id="wfls-captcha-token" />');
[127] Fix | Delete
tokenField.val('grecaptcha-missing');
[128] Fix | Delete
log.parent().append(tokenField);
[129] Fix | Delete
}
[130] Fix | Delete
}
[131] Fix | Delete
[132] Fix | Delete
typeof actionCallback === 'function' && actionCallback(true);
[133] Fix | Delete
}
[134] Fix | Delete
};
[135] Fix | Delete
[136] Fix | Delete
function showLoginMessage(messageHtml, type) {
[137] Fix | Delete
var heading = $('#login > h1');
[138] Fix | Delete
if (heading.length > 0) {
[139] Fix | Delete
var dom = (type === 'error' ? $('<div id="login_error">') : $('<p class="message">'));
[140] Fix | Delete
dom.addClass('wfls-login-message');
[141] Fix | Delete
dom.addClass('notice');
[142] Fix | Delete
if (type === 'error') {
[143] Fix | Delete
dom.addClass('notice-error');
[144] Fix | Delete
}
[145] Fix | Delete
dom.html(messageHtml);
[146] Fix | Delete
heading.after(dom);
[147] Fix | Delete
dom.get(0).scrollIntoView();
[148] Fix | Delete
return;
[149] Fix | Delete
}
[150] Fix | Delete
else if ($('.woocommerce').length > 0){
[151] Fix | Delete
var content = $('<div class="woocommerce wfls-login-message">');
[152] Fix | Delete
var errorList = $('<ul role="alert">')
[153] Fix | Delete
.addClass(type === 'error' ? 'woocommerce-error' : 'woocommerce-info');
[154] Fix | Delete
content.append(errorList);
[155] Fix | Delete
errorList.append($('<li>').html(messageHtml));
[156] Fix | Delete
var containerSearch = selectorSearch([
[157] Fix | Delete
'#primary',
[158] Fix | Delete
'.content-area',
[159] Fix | Delete
'#main',
[160] Fix | Delete
'.site-main',
[161] Fix | Delete
'main'
[162] Fix | Delete
]);
[163] Fix | Delete
var container = containerSearch();
[164] Fix | Delete
if (container === null) {
[165] Fix | Delete
container = loginLocator.getForm();
[166] Fix | Delete
}
[167] Fix | Delete
if (container !== null) {
[168] Fix | Delete
container.before(content);
[169] Fix | Delete
content.get(0).scrollIntoView();
[170] Fix | Delete
return;
[171] Fix | Delete
}
[172] Fix | Delete
}
[173] Fix | Delete
var messageModal = $('<div>')
[174] Fix | Delete
.attr('id', 'wfls-login-modal')
[175] Fix | Delete
.css({
[176] Fix | Delete
position: 'fixed',
[177] Fix | Delete
top: 0,
[178] Fix | Delete
right: 0,
[179] Fix | Delete
bottom: 0,
[180] Fix | Delete
left: 0,
[181] Fix | Delete
'background-color': 'rgba(0,0,0,0.5)',
[182] Fix | Delete
'z-index': 9999,
[183] Fix | Delete
display: 'flex',
[184] Fix | Delete
'align-items': 'center',
[185] Fix | Delete
'justify-content': 'center',
[186] Fix | Delete
padding: '16px'
[187] Fix | Delete
})
[188] Fix | Delete
.appendTo($('body'));
[189] Fix | Delete
messageModal.append(
[190] Fix | Delete
$('<div>')
[191] Fix | Delete
.css({
[192] Fix | Delete
'background-color': '#FFF',
[193] Fix | Delete
'border-radius': '4px',
[194] Fix | Delete
padding: '16px',
[195] Fix | Delete
'text-align': 'center'
[196] Fix | Delete
})
[197] Fix | Delete
.append(
[198] Fix | Delete
$('<p>').html(messageHtml)
[199] Fix | Delete
)
[200] Fix | Delete
.append(
[201] Fix | Delete
$('<button>').text('Dismiss')
[202] Fix | Delete
.on('click', function() {
[203] Fix | Delete
messageModal.remove();
[204] Fix | Delete
})
[205] Fix | Delete
)
[206] Fix | Delete
);
[207] Fix | Delete
}
[208] Fix | Delete
[209] Fix | Delete
[210] Fix | Delete
var wfls_init_captcha_contact = function() {
[211] Fix | Delete
$('.wfls-registration-captcha-contact').on('click', function(e) {
[212] Fix | Delete
e.preventDefault();
[213] Fix | Delete
e.stopPropagation();
[214] Fix | Delete
[215] Fix | Delete
if (registrationLocator.locate()) {
[216] Fix | Delete
$('#wfls-prompt-overlay').remove();
[217] Fix | Delete
var overlay = $('<div id="wfls-prompt-overlay"></div>');
[218] Fix | Delete
var wrapper = $('<div id="wfls-prompt-wrapper"></div>');
[219] Fix | Delete
var field = $('<p><label for="wfls-message"></label><br/><textarea name="wfls-message" id="wfls-message" class="wfls-textarea"></textarea></p>');
[220] Fix | Delete
field.find('label[for=wfls-message]').text(__('Message to Support'));
[221] Fix | Delete
var nonce = $('<input type="hidden" name="wfls-message-nonce" id="wfls-message-nonce"/>');
[222] Fix | Delete
var button = $('<p class="submit"><input type="submit" name="wfls-support-submit" id="wfls-support-submit" class="button button-primary button-large"/></p>');
[223] Fix | Delete
button.find('input[type=submit]').val(__('Send'));
[224] Fix | Delete
wrapper.append(field).append(nonce).append(button);
[225] Fix | Delete
overlay.append(wrapper);
[226] Fix | Delete
registrationLocator.getForm().css('position', 'relative').append(overlay);
[227] Fix | Delete
[228] Fix | Delete
$('#wfls-message-nonce').val($(this).data('token'));
[229] Fix | Delete
[230] Fix | Delete
$('#wfls-support-submit').on('click', function(e) {
[231] Fix | Delete
e.preventDefault();
[232] Fix | Delete
e.stopPropagation();
[233] Fix | Delete
[234] Fix | Delete
$('#login_error, p.message').remove();
[235] Fix | Delete
[236] Fix | Delete
var data = registrationLocator.getForm().serialize();
[237] Fix | Delete
data += '&action=wordfence_ls_register_support';
[238] Fix | Delete
[239] Fix | Delete
$.ajax({
[240] Fix | Delete
type: 'POST',
[241] Fix | Delete
url: WFLSVars.ajaxurl,
[242] Fix | Delete
dataType: 'json',
[243] Fix | Delete
data: data,
[244] Fix | Delete
success: function(json) {
[245] Fix | Delete
if (json.hasOwnProperty('error')) {
[246] Fix | Delete
showLoginMessage(json.error, 'error');
[247] Fix | Delete
var dom = $('<div id="login_error">' + json.error + '</div>');
[248] Fix | Delete
$('#login > h1').after(dom);
[249] Fix | Delete
}
[250] Fix | Delete
else if (json.hasOwnProperty('message')) { //Success
[251] Fix | Delete
showLoginMessage(json.message, 'message');
[252] Fix | Delete
var dom = $('<p class="message">' + json.message + '</p>');
[253] Fix | Delete
$('#login > h1').after(dom);
[254] Fix | Delete
$('#wfls-support-submit, #wfls-message').attr('disabled', true);
[255] Fix | Delete
}
[256] Fix | Delete
},
[257] Fix | Delete
error: function(err) {
[258] Fix | Delete
showLoginMessage(__('An error was encountered while trying to send the message. Please try again.'), 'error');
[259] Fix | Delete
var dom = $('<div id="login_error"></div>');
[260] Fix | Delete
dom.html(__('<strong>ERROR</strong>: An error was encountered while trying to send the message. Please try again.'));
[261] Fix | Delete
$('#login > h1').after(dom);
[262] Fix | Delete
}
[263] Fix | Delete
});
[264] Fix | Delete
});
[265] Fix | Delete
[266] Fix | Delete
field.find("#wfls-message").focus();
[267] Fix | Delete
}
[268] Fix | Delete
});
[269] Fix | Delete
};
[270] Fix | Delete
[271] Fix | Delete
function FormBlocker(form, buttonSelector, clickOnSubmit) {
[272] Fix | Delete
[273] Fix | Delete
var self = this;
[274] Fix | Delete
var blocked = false;
[275] Fix | Delete
var released = false;
[276] Fix | Delete
clickOnSubmit = clickOnSubmit || false;
[277] Fix | Delete
var clickSubmitInProgress = false;
[278] Fix | Delete
[279] Fix | Delete
this.getButtons = function() {
[280] Fix | Delete
return form.find(buttonSelector);
[281] Fix | Delete
}
[282] Fix | Delete
[283] Fix | Delete
this.block = function() {
[284] Fix | Delete
if (blocked)
[285] Fix | Delete
return false;
[286] Fix | Delete
blocked = true;
[287] Fix | Delete
this.getButtons().addClass('disabled').prop('disabled', true);
[288] Fix | Delete
return true;
[289] Fix | Delete
}
[290] Fix | Delete
[291] Fix | Delete
this.unblock = function() {
[292] Fix | Delete
this.getButtons().removeClass('disabled').prop('disabled', false);
[293] Fix | Delete
blocked = false;
[294] Fix | Delete
}
[295] Fix | Delete
[296] Fix | Delete
this.release = function() {
[297] Fix | Delete
released = true;
[298] Fix | Delete
}
[299] Fix | Delete
[300] Fix | Delete
this.clickSubmit = function() {
[301] Fix | Delete
this.unblock();
[302] Fix | Delete
var submitButton = this.getButtons().first();
[303] Fix | Delete
setTimeout(function() {
[304] Fix | Delete
submitButton.trigger('click');
[305] Fix | Delete
}, 1);
[306] Fix | Delete
}
[307] Fix | Delete
[308] Fix | Delete
this.initialize = function(callback) {
[309] Fix | Delete
form.on('submit', function(event) {
[310] Fix | Delete
if (released && (!clickOnSubmit || clickSubmitInProgress)) {
[311] Fix | Delete
if (clickSubmitInProgress)
[312] Fix | Delete
clickSubmitInProgress = false;
[313] Fix | Delete
return;
[314] Fix | Delete
}
[315] Fix | Delete
event.preventDefault();
[316] Fix | Delete
event.stopPropagation();
[317] Fix | Delete
if (released) {
[318] Fix | Delete
clickSubmitInProgress = true;
[319] Fix | Delete
self.clickSubmit();
[320] Fix | Delete
return;
[321] Fix | Delete
}
[322] Fix | Delete
if (self.block()) {
[323] Fix | Delete
callback();
[324] Fix | Delete
}
[325] Fix | Delete
});
[326] Fix | Delete
}
[327] Fix | Delete
[328] Fix | Delete
}
[329] Fix | Delete
[330] Fix | Delete
var wfls_query_ajax = function(blocker) {
[331] Fix | Delete
$('.wfls-login-message').remove();
[332] Fix | Delete
[333] Fix | Delete
if (!loginLocator.locate()) {
[334] Fix | Delete
console.error('Required login elements not found');
[335] Fix | Delete
return;
[336] Fix | Delete
}
[337] Fix | Delete
var form = loginLocator.getForm();
[338] Fix | Delete
var log = loginLocator.getInput();
[339] Fix | Delete
var pwd = loginLocator.getExtra('password');
[340] Fix | Delete
[341] Fix | Delete
var data = $(form).serialize();
[342] Fix | Delete
data += '&action=wordfence_ls_authenticate';
[343] Fix | Delete
[344] Fix | Delete
$.ajax({
[345] Fix | Delete
type: 'POST',
[346] Fix | Delete
url: WFLSVars.ajaxurl,
[347] Fix | Delete
dataType: 'json',
[348] Fix | Delete
data: data,
[349] Fix | Delete
success: function(json) {
[350] Fix | Delete
if (json.hasOwnProperty('reset') && json.reset) {
[351] Fix | Delete
$('#wfls-prompt-overlay').remove();
[352] Fix | Delete
}
[353] Fix | Delete
[354] Fix | Delete
if (json.hasOwnProperty('error')) {
[355] Fix | Delete
showLoginMessage(json.error, 'error');
[356] Fix | Delete
$('#wfls-token').val('');
[357] Fix | Delete
[358] Fix | Delete
if (parseInt(WFLSVars.useCAPTCHA)) {
[359] Fix | Delete
wfls_init_captcha();
[360] Fix | Delete
}
[361] Fix | Delete
}
[362] Fix | Delete
else if (json.hasOwnProperty('message')) {
[363] Fix | Delete
showLoginMessage(json.message, 'message');
[364] Fix | Delete
$('#wfls-token').val('');
[365] Fix | Delete
[366] Fix | Delete
if (parseInt(WFLSVars.useCAPTCHA)) {
[367] Fix | Delete
wfls_init_captcha();
[368] Fix | Delete
}
[369] Fix | Delete
}
[370] Fix | Delete
else if (json.hasOwnProperty('login')) {
[371] Fix | Delete
if (json.hasOwnProperty('captcha')) {
[372] Fix | Delete
var captchaField = $('#wfls-captcha-jwt');
[373] Fix | Delete
if (!captchaField.length) {
[374] Fix | Delete
captchaField = $('<input type="hidden" name="wfls-captcha-jwt" id="wfls-captcha-jwt" value=""/>');
[375] Fix | Delete
form.append(captchaField);
[376] Fix | Delete
}
[377] Fix | Delete
[378] Fix | Delete
$('#wfls-captcha-jwt').val(json.captcha);
[379] Fix | Delete
}
[380] Fix | Delete
[381] Fix | Delete
blocker.release();
[382] Fix | Delete
if (json.hasOwnProperty('two_factor_required') && json.two_factor_required) {
[383] Fix | Delete
if ($('#wfls-prompt-overlay').length === 0) {
[384] Fix | Delete
var overlay = $('<div id="wfls-prompt-overlay"></div>');
[385] Fix | Delete
var wrapper = $('<div id="wfls-prompt-wrapper"></div>');
[386] Fix | Delete
var label = $('<label for="wfls-token">');
[387] Fix | Delete
label.text(__('Wordfence 2FA Code') + ' ');
[388] Fix | Delete
label.append($('<a href="javascript:void(0)" class="wfls-2fa-code-help wfls-tooltip-trigger"><i class="dashicons dashicons-editor-help"></i></a>').attr('title', __('The Wordfence 2FA Code can be found within the authenticator app you used when first activating two-factor authentication. You may also use one of your recovery codes.')));
[389] Fix | Delete
label = $('<p>').append(label);
[390] Fix | Delete
var field = $('<p><input type="text" name="wfls-token" id="wfls-token" aria-describedby="wfls-token-error" class="input" value="" size="6" autocomplete="one-time-code"/></p>');
[391] Fix | Delete
var remember = $('<p class="wfls-remember-device-wrapper"><label for="wfls-remember-device"><input name="wfls-remember-device" type="checkbox" id="wfls-remember-device" value="1" /> </label></p>');
[392] Fix | Delete
remember.find('label').append(__('Remember for 30 days'));
[393] Fix | Delete
var button = $('<p class="submit"><input type="submit" name="wfls-token-submit" id="wfls-token-submit" class="button button-primary button-large"/></p>');
[394] Fix | Delete
button.find('input[type=submit]').val(__('Log In'));
[395] Fix | Delete
wrapper.append(label);
[396] Fix | Delete
wrapper.append(field);
[397] Fix | Delete
if (parseInt(WFLSVars.allowremember)) {
[398] Fix | Delete
wrapper.append(remember);
[399] Fix | Delete
}
[400] Fix | Delete
wrapper.append(button);
[401] Fix | Delete
overlay.append(wrapper);
[402] Fix | Delete
form.css('position', 'relative').append(overlay);
[403] Fix | Delete
form.on('submit', function() {
[404] Fix | Delete
$('#wfls-token-submit').prop('disabled', true).addClass('disabled');
[405] Fix | Delete
});
[406] Fix | Delete
$('#wfls-token').focus();
[407] Fix | Delete
[408] Fix | Delete
new $.Zebra_Tooltips($('.wfls-tooltip-trigger'));
[409] Fix | Delete
}
[410] Fix | Delete
}
[411] Fix | Delete
else { //Unexpected response, skip AJAX and process via the regular login flow
[412] Fix | Delete
blocker.clickSubmit();
[413] Fix | Delete
}
[414] Fix | Delete
}
[415] Fix | Delete
blocker.unblock();
[416] Fix | Delete
},
[417] Fix | Delete
error: function(err) {
[418] Fix | Delete
if (err.status == 503 || err.status == 403) {
[419] Fix | Delete
if ($('.woocommerce').length > 0) {
[420] Fix | Delete
if (err.status == 503) {
[421] Fix | Delete
showLoginMessage(__('<strong>ERROR</strong>: Login failed with status code 503. Please contact the site administrator.'), 'error');
[422] Fix | Delete
}
[423] Fix | Delete
else if (err.status == 403) {
[424] Fix | Delete
showLoginMessage(__('<strong>ERROR</strong>: Login failed with status code 403. Please contact the site administrator.'), 'error');
[425] Fix | Delete
}
[426] Fix | Delete
blocker.unblock();
[427] Fix | Delete
}
[428] Fix | Delete
else {
[429] Fix | Delete
window.location.reload(true);
[430] Fix | Delete
}
[431] Fix | Delete
[432] Fix | Delete
return;
[433] Fix | Delete
}
[434] Fix | Delete
showLoginMessage(__('<strong>ERROR</strong>: An error was encountered while trying to authenticate. Please try again.'), 'error');
[435] Fix | Delete
blocker.unblock();
[436] Fix | Delete
}
[437] Fix | Delete
});
[438] Fix | Delete
};
[439] Fix | Delete
[440] Fix | Delete
$(function() {
[441] Fix | Delete
//Login
[442] Fix | Delete
if (loginLocator.locate()) {
[443] Fix | Delete
var loginBlocker = new FormBlocker(loginLocator.getForm(), '#wp-submit,[type=submit][name=login]', true);
[444] Fix | Delete
loginBlocker.initialize(function() {
[445] Fix | Delete
if (parseInt(WFLSVars.useCAPTCHA)) {
[446] Fix | Delete
wfls_init_captcha(function() { wfls_query_ajax(loginBlocker); });
[447] Fix | Delete
}
[448] Fix | Delete
else {
[449] Fix | Delete
wfls_query_ajax(loginBlocker);
[450] Fix | Delete
}
[451] Fix | Delete
});
[452] Fix | Delete
}
[453] Fix | Delete
[454] Fix | Delete
//Registration
[455] Fix | Delete
if (registrationLocator.locate() && parseInt(WFLSVars.useCAPTCHA)) {
[456] Fix | Delete
var registrationBlocker = new FormBlocker(registrationLocator.getForm(), '[type=submit]');
[457] Fix | Delete
registrationBlocker.initialize(function() {
[458] Fix | Delete
wfls_init_captcha(
[459] Fix | Delete
function() {
[460] Fix | Delete
registrationBlocker.release();
[461] Fix | Delete
registrationBlocker.clickSubmit();
[462] Fix | Delete
},
[463] Fix | Delete
registrationLocator.getInput()
[464] Fix | Delete
);
[465] Fix | Delete
});
[466] Fix | Delete
}
[467] Fix | Delete
[468] Fix | Delete
var verificationField = $('#wfls-email-verification');
[469] Fix | Delete
if (verificationField.length) {
[470] Fix | Delete
verificationField.val(WFLSVars.verification || '');
[471] Fix | Delete
}
[472] Fix | Delete
else {
[473] Fix | Delete
var log = getRelevantInputs();
[474] Fix | Delete
if (log.length) {
[475] Fix | Delete
verificationField = $('<input type="hidden" name="wfls-email-verification" id="wfls-email-verification" />');
[476] Fix | Delete
verificationField.val(WFLSVars.verification);
[477] Fix | Delete
log.parent().append(verificationField);
[478] Fix | Delete
}
[479] Fix | Delete
}
[480] Fix | Delete
[481] Fix | Delete
if (parseInt(WFLSVars.useCAPTCHA)) {
[482] Fix | Delete
wfls_init_captcha_contact();
[483] Fix | Delete
}
[484] Fix | Delete
});
[485] Fix | Delete
})(jQuery);
[486] Fix | Delete
[487] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function