CoreFiles by mySites.guru
login.es6.min.js1 lines, 2,700 bytes, from Joomla_4.0.0-beta2-Beta-Full_Package.zip
Raw History Compare with 4.0.0-beta
md5
f7013112bd6d32cb680765bd1cce6665
sha1
a350dc6e5dd89d70a4960cfeaf0d6f9b1f1ee33a
sha256
21594096c1a4b9ca826f0db3859c5bcf67f85fed3f0b9387cf5ddc48df35564f
window.Joomla=window.Joomla||{},((a,b)=>{'use strict';const c=(a,b="")=>{let d="";return Object.keys(a).forEach(e=>"object"==typeof a[e]?void(d+=`${c(a[e],e)}`):(0<d.length&&(d+="&"),void(d+=""===b?`${encodeURIComponent(e)}=${encodeURIComponent(a[e])}`:`${encodeURIComponent(b)}[${encodeURIComponent(e)}]=${encodeURIComponent(a[e])}`))),d},d=(a,b)=>{const c=a.querySelectorAll(b);return c.length?c[0]:null},e=(a,b)=>{let c=null;if(!a)return c;const e=a.parentElement;if("FORM"===e.nodeName)return c=d(e,b),c;const f=e.querySelectorAll("form");if(f.length)for(let a=0;a<f.length;a+=1)if(c=d(f[a],b),null!==c)return c;return null},f=b=>{a.renderMessages({error:[b]})},g=(b,c)=>{const d=b=>btoa(String.fromCharCode(...b)),e=a=>{let b=a.replace(/-/g,"+").replace(/_/g,"/");const c=b.length%4;if(c){if(1===c)throw new Error("InvalidLengthError: Input base64url string is the wrong length to determine padding");b+=Array(5-c).join("=")}return b};return b.challenge?void(b.challenge=Uint8Array.from(window.atob(e(b.challenge)),a=>a.charCodeAt(0)),b.allowCredentials&&(b.allowCredentials=b.allowCredentials.map(a=>(a.id=Uint8Array.from(window.atob(e(a.id)),a=>a.charCodeAt(0)),a))),navigator.credentials.get({publicKey:b}).then(a=>{const b={id:a.id,type:a.type,rawId:d(new Uint8Array(a.rawId)),response:{authenticatorData:d(new Uint8Array(a.response.authenticatorData)),clientDataJSON:d(new Uint8Array(a.response.clientDataJSON)),signature:d(new Uint8Array(a.response.signature)),userHandle:a.response.userHandle?d(new Uint8Array(a.response.userHandle)):null}};window.location=`${c}&option=com_ajax&group=system&plugin=webauthn&`+`format=raw&akaction=login&encoding=redirect&data=${btoa(JSON.stringify(b))}`}).catch(a=>{f(a)})):void f(a.JText._("PLG_SYSTEM_WEBAUTHN_ERR_INVALID_USERNAME"))};a.plgSystemWebauthnLogin=(d,h)=>{const i=b.getElementById(d),j=e(i,"input[name=username]"),k=e(i,"input[name=return]");if(null===j)return a.renderMessages({error:[a.JText._("PLG_SYSTEM_WEBAUTHN_ERR_CANNOT_FIND_USERNAME")]}),!1;const l=j.value,m=k?k.value:null;if(""===l)return a.renderMessages({error:[a.JText._("PLG_SYSTEM_WEBAUTHN_ERR_EMPTY_USERNAME")]}),!1;return a.request({url:h,method:"POST",data:c({option:"com_ajax",group:"system",plugin:"webauthn",format:"raw",akaction:"challenge",encoding:"raw",username:l,returnUrl:m}),onSuccess(a){let b={};try{b=JSON.parse(a)}catch(a){}g(b,h)},onError:a=>{f(`${a.status} ${a.statusText}`)}}),!1};const h=[].slice.call(b.querySelectorAll(".plg_system_webauthn_login_button"));h.length&&h.forEach(b=>{b.addEventListener("click",({currentTarget:b})=>{a.plgSystemWebauthnLogin(b.getAttribute("data-webauthn-form"),b.getAttribute("data-webauthn-url"))})})})(Joomla,document);

The same content is in 6 releases, Joomla 4.0.0-beta2 to 4.0.0-beta7. See them all, or every version of this file.