function AuthenticationLogin(){var n=this;$("#frmExternalLogin").on("submit",function(t){var i=$(this);$.ajax({type:i.attr("method"),url:i.attr("action"),data:i.serialize(),success:n.onExternalLoginComplete,error:n.onExternalLoginFailure});t.preventDefault()});n.onExternalLoginFailure=function(){var n,t;if(loader.hideLoader("#frmExternalLogin"),n=$(".external-providers > .external-message-wrapper"),n.length&&(t=n.find(".external-message"),t.length))try{t.html("Request fail. Please reload and try again.");n.removeClass("d-none");setTimeout(function(){location.reload()},2e3)}catch(i){console.log(i)}};n.onExternalLoginComplete=function(n){var t,i;if(loader.hideLoader("#frmExternalLogin"),t=$(".external-providers > .external-message-wrapper"),t.length&&(i=t.find(".external-message"),i.length))try{n&&n.success?(i.html(""),t.addClass("d-none"),window.location=n.url):n?(i.html(n.message),t.removeClass("d-none")):(i.html("Request fail. Please reload and try again."),t.removeClass("d-none"),setTimeout(function(){location.reload()},2e3))}catch(r){console.log(r)}}}function validateForm(n){var t=$(n),r="",i=!0,o,u,s,c,l,f,h,e;return r=t.data("label"),r||(r=t.attr("placeholder").replace("*","")),t.prop("required")&&t.val()===""?(o=$("#hidErrorFieldRequired"),o.length?helper.addInvalid(t,"*"+o.val().replace("{0}",r)):helper.addInvalid(t,"*"+r+" is required"),i=!1):(helper.removeInvalid(t),i=!0),u=t.data("length"),i&&u&&(u!==t.val().length?(s=$("#hidErrorFieldLength"),s.length?helper.addInvalid(t,"*"+s.val().replace("{0}",u).replace("{1}",r)):helper.addInvalid(t,"*Must enter "+u+" digits for "+r),i=!1):(helper.removeInvalid(t),i=!0)),f=t.attr("type"),i&&f==="password"&&(c=t.val(),l=/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,20}$/,c.match(l)?i=!0:(helper.addInvalid(t,"*Your password must be at least 8 characters. We suggest including a lower-case letter, an upper-case letter, a number and one special character (!@#$%^&*)."),i=!1)),f=t.attr("type"),i&&f==="email"&&(h=$(n).val(),h.length>0&&(e=$("#hidValidateEmailUrl").val(),e&&(e+="/"+h,helper.ajaxGet(e,function(n){if(n.isValid)helper.removeInvalid(t),i=!0;else{var r=$("#hidErrorEmailNotAllow");r.length?helper.addInvalid(t,"*"+r.val()):helper.addInvalid(t,"*The email address is not allowed");i=!1}},null,!1)))),i}function validateLoginForm(n){var t=$(n),r="",i=!0,e,u,o,h,s,f;return r=t.data("label"),r||(r=t.attr("placeholder").replace("*","")),t.prop("required")&&t.val()===""?(e=$("#hidErrorFieldRequired"),e.length?helper.addInvalid(t,"*"+e.val().replace("{0}",r)):helper.addInvalid(t,"*"+r+" is required"),i=!1):(helper.removeInvalid(t),i=!0),u=t.data("length"),i&&u&&(u!==t.val().length?(o=$("#hidErrorFieldLength"),o.length?helper.addInvalid(t,"*"+o.val().replace("{0}",u).replace("{1}",r)):helper.addInvalid(t,"*Must enter "+u+" digits for "+r),i=!1):(helper.removeInvalid(t),i=!0)),h=t.attr("type"),i&&h==="email"&&(s=$(n).val(),s.length>0&&(f=$("#hidValidateEmailUrl").val(),f&&(f+="/"+s,helper.ajaxGet(f,function(n){if(n.isValid)helper.removeInvalid(t),i=!0;else{var r=$("#hidErrorEmailNotAllow");r.length?helper.addInvalid(t,"*"+r.val()):helper.addInvalid(t,"*The email address is not allowed");i=!1}},null,!1)))),i}$(document).ready(function(){$(".form-control-input").on("input",function(n){var t=$(n.currentTarget);t.length&&helper.removeInvalid(t)});$(document).on("click keyup",".pwd-visible.on",function(n){var t=$(n.currentTarget),i,r;(t.length&&n.type==="click"||n.keyCode==="Enter"||n.keyCode==13||n.keyCode==32)&&(t.hide(),i=t.parent().find(".form-control-input"),i.length&&i.attr("type","text"),r=t.siblings(".pwd-visible.off"),r.length&&r.show())});$(document).on("click keyup",".pwd-visible.off",function(n){var t=$(n.currentTarget),i,r;(t.length&&n.type==="click"||n.keyCode==="Enter"||n.keyCode==13||n.keyCode==32)&&(t.hide(),i=t.parent().find(".form-control-input"),i.length&&i.attr("type","password"),r=t.siblings(".pwd-visible.on"),r.length&&r.show())});$(".btn-close-alert").on("click",function(){var t=$(this),n=t.closest(".alert-wrapper");n.length&&(n.addClass("d-none"),n.find(".alert-body").html(""))});$(".btn-submit").on("click",function(n){var i=!0,t=$(this).closest("form"),r;return(t.find(".form-control-input").each(function(n,t){i=validateForm(t)&&i}),helper.clearAlert(),n.stopPropagation,n.preventDefault,i)?(loader.showLoader(t),r=t.data("actionname"),helper.getRecaptchaToken(r,function(n){var i=t.find(".recaptcha");i.length?(i.val(n),t.submit()):location.reload()}),!1):i})})