| 1 |
!function(e){var n={};function r(t){if(n[t])return n[t].exports;var a=n[t]={i:t,l:!1,exports:{}};return e[t].call(a.exports,a,a.exports,r),a.l=!0,a.exports}r.m=e,r.c=n,r.d=function(e,n,t){r.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:t})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,n){if(1&n&&(e=r(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(r.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var a in e)r.d(t,a,function(n){return e[n]}.bind(null,a));return t},r.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(n,"a",n),n},r.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},r.p="/",r(r.s=253)}({253:function(e,n,r){e.exports=r(254)},254:function(e,n){function r(e,n){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,n){if(!e)return;if("string"==typeof e)return t(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return t(e,n)}(e))||n&&e&&"number"==typeof e.length){r&&(e=r);var a=0,i=function(){};return{s:i,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,f=!0,d=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return f=e.done,e},e:function(e){d=!0,o=e},f:function(){try{f||null==r.return||r.return()}finally{if(d)throw o}}}}function t(e,n){(null==n||n>e.length)&&(n=e.length);for(var r=0,t=new Array(n);r<n;r++)t[r]=e[r];return t}!function(e){var n=!1,t=e("#login"),a=t.find("#wpdef-2fa-form-"+webauthn.provider_slug),i=t.find("#wrap-nav #nav");function o(){n=!1,a.find(".wpdef-2fa-biometric-process-desc").hide(),a.find("#wpdef-2fa-biometric-retry-btn").show()}function f(e){var n='<div id="login_error">'+e+"</div>";t.find("h1").after(n)}e((function(){!1===wpdefCheckBrowserSupportForWebauthn()?(e=webauthn.i18n.client_webauthn_notice,n='<div class="wpdef-notice warning webauthn-client-notice"><span class="dashicons dashicons-info"></span><span class="wpdef-notice-message">'+e+"</span></div>",a.append(n),a.find(".wpdef-2fa-biometric-process-desc").hide()):webauthn.provider_slug===webauthn.two_fa_default_provider&&null===webauthn.error&&a.find("#wpdef-2fa-biometric-retry-btn").trigger("click");var e,n})),i.find("#wpdef-2fa-link-"+webauthn.provider_slug).add(a.find("#wpdef-2fa-biometric-retry-btn")).on("click",(function(i){i.preventDefault(),!0!==n&&!1!==wpdefCheckBrowserSupportForWebauthn()&&(n=!0,t.find("#login_error").remove(),a.find("#wpdef-2fa-biometric-retry-btn").hide(),a.find(".wpdef-2fa-biometric-process-desc").show(),e.ajax({url:webauthn.admin_url,type:"POST",data:{action:"defender_webauthn_get_option",username:webauthn.username,_def_nonce:webauthn.nonce},success:function(e){if(!1===e.success||void 0===e.data.challenge){return f("undefined"!==e.data.message&&"undefined"!==e.data.code&&0<e.data.code?e.data.message:webauthn.i18n.login_failed),void o()}var n=e.data;if(n.challenge=Uint8Array.from(window.atob(wpdefBase64Url2Base64(n.challenge)),(function(e){return e.charCodeAt(0)})),n.allowCredentials){var t,i=r(n.allowCredentials);try{for(i.s();!(t=i.n()).done;){var d=t.value;d.transports=["internal"],d.id=Uint8Array.from(window.atob(wpdefBase64Url2Base64(d.id)),(function(e){return e.charCodeAt(0)}))}}catch(e){i.e(e)}finally{i.f()}}var u=n.clientID;delete n.clientID,navigator.credentials.get({publicKey:n}).then((function(e){return{id:e.id,type:e.type,rawId:wpdefArrayToBase64String(new Uint8Array(e.rawId)),response:{authenticatorData:wpdefArrayToBase64String(new Uint8Array(e.response.authenticatorData)),clientDataJSON:wpdefArrayToBase64String(new Uint8Array(e.response.clientDataJSON)),signature:wpdefArrayToBase64String(new Uint8Array(e.response.signature)),userHandle:e.response.userHandle?wpdefArrayToBase64String(new Uint8Array(e.response.userHandle)):null}}})).then(JSON.stringify).then((function(e){a.find("#wpdef-2fa-biometric-data").val(window.btoa(e)),a.find("#wpdef-2fa-biometric-username").val(webauthn.username),a.find("#wpdef-2fa-biometric-client-id").val(u),a.find("#wpdef-2fa-biometric-nonce").val(webauthn.nonce),a.find("#wpdef-2fa-biometric-submit-btn").trigger("click")})).catch((function(e){f(webauthn.i18n.login_failed),o()}))},error:function(){f(webauthn.i18n.login_failed),o()}}))}))}(jQuery)}}); |