[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/media/plg_multifactorauth_webauthn/js/ -> webauthn.min.js (source)

   1  ((e,t)=>{let a=null;const n=e=>btoa(String.fromCharCode(...e)),r=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/");const a=t.length%4;if(a){if(1===a)throw new Error("InvalidLengthError: Input base64url string is the wrong length to determine padding");t+=new Array(5-a).join("=")}return t},i=t=>{try{e.renderMessages({error:t})}catch(e){alert(t)}},o=e=>{try{t.getElementById("plg_multifactorauth_webauthn_validate_button").style.disabled="null"}catch(e){}i(e)},s=a=>{if(a.preventDefault(),!("credentials"in navigator))return i(e.Text._("PLG_MULTIFACTORAUTH_WEBAUTHN_ERR_NOTAVAILABLE_HEAD")),!1;const s=t.forms["com-users-method-edit"].querySelectorAll('input[name="pkRequest"]')[0].value,l=JSON.parse(atob(s));return l.challenge=Uint8Array.from(window.atob(r(l.challenge)),(e=>e.charCodeAt(0))),l.user.id=Uint8Array.from(window.atob(l.user.id),(e=>e.charCodeAt(0))),l.excludeCredentials&&(l.excludeCredentials=l.excludeCredentials.map((e=>(e.id=Uint8Array.from(window.atob(r(e.id)),(e=>e.charCodeAt(0))),e)))),navigator.credentials.create({publicKey:l}).then((e=>{const a={id:e.id,type:e.type,rawId:n(new Uint8Array(e.rawId)),response:{clientDataJSON:n(new Uint8Array(e.response.clientDataJSON)),attestationObject:n(new Uint8Array(e.response.attestationObject))}};t.getElementById("com-users-method-code").value=btoa(JSON.stringify(a)),t.forms["com-users-method-edit"].submit()}),(e=>{o(e)})),!1},l=s=>(s.preventDefault(),a=JSON.parse(window.atob(e.getOptions("com_users.authData"))),t.getElementById("users-mfa-captive-button-submit").style.disabled="disabled",(()=>{if(!("credentials"in navigator))return void i(e.Text._("PLG_MULTIFACTORAUTH_WEBAUTHN_ERR_NOTAVAILABLE_HEAD"));const s=a;s.challenge?(s.challenge=Uint8Array.from(window.atob(r(s.challenge)),(e=>e.charCodeAt(0))),s.allowCredentials&&(s.allowCredentials=s.allowCredentials.map((e=>(e.id=Uint8Array.from(window.atob(r(e.id)),(e=>e.charCodeAt(0))),e)))),navigator.credentials.get({publicKey:s}).then((e=>{const a={id:e.id,type:e.type,rawId:n(new Uint8Array(e.rawId)),response:{authenticatorData:n(new Uint8Array(e.response.authenticatorData)),clientDataJSON:n(new Uint8Array(e.response.clientDataJSON)),signature:n(new Uint8Array(e.response.signature)),userHandle:e.response.userHandle?n(new Uint8Array(e.response.userHandle)):null}};t.getElementById("users-mfa-code").value=btoa(JSON.stringify(a)),t.getElementById("users-mfa-captive-form").submit()}),(e=>{o(e)}))):o(e.Text._("PLG_MULTIFACTORAUTH_WEBAUTHN_ERR_NO_STORED_CREDENTIAL"))})(),!1);t.getElementById("multifactorauth-webauthn-missing").style.display="none",void 0===navigator.credentials&&(t.getElementById("multifactorauth-webauthn-missing").style.display="block",t.getElementById("multifactorauth-webauthn-controls").style.display="none"),window.addEventListener("DOMContentLoaded",(()=>{"validate"===e.getOptions("com_users.pagetype")?t.getElementById("users-mfa-captive-button-submit").addEventListener("click",l):t.querySelectorAll(".multifactorauth_webauthn_setup").forEach((e=>{e.addEventListener("click",s)}))}))})(Joomla,document);


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer