| 1 |
(self.webpackChunkwp_defender=self.webpackChunkwp_defender||[]).push([[874],{7253:()=>{function e(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=function(e,r){if(e){if("string"==typeof e)return n(e,r);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?n(e,r):void 0}}(e))||r&&e&&"number"==typeof e.length){t&&(e=t);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(){t=t.call(e)},n:function(){var e=t.next();return f=e.done,e},e:function(e){d=!0,o=e},f:function(){try{f||null==t.return||t.return()}finally{if(d)throw o}}}}function n(e,n){(null==n||n>e.length)&&(n=e.length);for(var r=0,t=Array(n);r<n;r++)t[r]=e[r];return t}!function(n){var r=!1,t=null,a=n("#login"),i=a.find("#wpdef-2fa-form-"+webauthn.provider_slug);a.find("#wrap-nav #nav");function o(t,a){t.preventDefault(),!0!==r&&!1!==wpdefCheckBrowserSupportForWebauthn()&&(f(),n.ajax({url:webauthn.admin_url,type:"POST",data:{action:"defender_webauthn_get_option",username:webauthn.username,type:a,_def_nonce:webauthn.nonce},success:function(n){if(!1===n.success||void 0===n.data.challenge){return c("undefined"!==n.data.message&&"undefined"!==n.data.code&&0<n.data.code?n.data.message:webauthn.i18n.login_failed),void d()}var r=n.data;if(r.challenge=Uint8Array.from(window.atob(wpdefBase64Url2Base64(r.challenge)),function(e){return e.charCodeAt(0)}),r.allowCredentials){var t,o=e(r.allowCredentials);try{for(o.s();!(t=o.n()).done;){var f=t.value;"cross-platform"===a?f.transports=["usb","nfc","ble"]:"platform"===a&&(f.transports=["internal"]),f.id=Uint8Array.from(window.atob(wpdefBase64Url2Base64(f.id)),function(e){return e.charCodeAt(0)})}}catch(e){o.e(e)}finally{o.f()}}var s=r.clientID;delete r.clientID,navigator.credentials.get({publicKey:r}).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){i.find("#wpdef-2fa-biometric-data").val(window.btoa(e)),i.find("#wpdef-2fa-biometric-username").val(webauthn.username),i.find("#wpdef-2fa-biometric-client-id").val(s),i.find("#wpdef-2fa-biometric-nonce").val(webauthn.nonce),i.find("#wpdef-2fa-biometric-submit-btn").trigger("click")}).catch(function(e){c(webauthn.i18n.login_failed),d()})},error:function(){c(webauthn.i18n.login_failed),d()}}))}function f(){r=!0,a.find("#login_error").remove(),i.find(".welcome-screen").hide(),i.find(".webauthn-"+t).show(),i.find(".wpdef-2fa-webauthn-control").hide(),i.find(".wpdef-2fa-biometric-process-desc").show()}function d(){r=!1,i.find(".wpdef-2fa-biometric-process-desc").hide(),i.find(".wpdef-2fa-webauthn-control").show()}function c(e){var n='<div id="login_error" class="notice notice-error">'+e+"</div>";a.find("h1").after(n)}n(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>",i.append(n),i.find(".wpdef-2fa-biometric-process-desc").hide());var e,n}),i.find(".option-row").on("click",function(e){o(e,t=n(this).attr("data-authType"))}),i.find("#wpdef-2fa-biometric-retry-btn").on("click",function(e){null!==t&&o(e,t)}),i.find("#wpdef-2fa-webauthn-back-btn").on("click",function(e){null!==t&&(a.find("#login_error").remove(),i.find(".welcome-screen").show(),i.find(".webauthn-"+t).hide(),i.find(".wpdef-2fa-webauthn-control").hide())})}(jQuery)}},e=>{var n;n=7253,e(e.s=n)}]); |