1import{r as y,j as s}from"./index-C9xqvqOs.js";import{a as O,k}from"./KcPage-D0t0K9e9.js";import{u as A}from"./useIsPasswordRevealed-DxW8lXfc.js";import{g as B,c as I}from"./kcClsx-ObyPO-fC.js";import{u as E,w as L}from"./waitForElementMountedOnDom-BjpPtlj3.js";O();O();function P(h){const{webAuthnButtonId:t,kcContext:o,i18n:i}=h,{url:l,isUserIdentified:g,challenge:d,userVerification:e,rpId:c,createTimeout:a}=o,{msgStr:u,isFetchingTranslations:p}=i,{insertScriptTags:j}=E({componentOrHookName:"Login",scriptTags:[{type:"module",textContent:()=>` 2 3 import { authenticateByWebAuthn } from "${l.resourcesPath}/js/webauthnAuthenticate.js"; 4 import { initAuthenticate } from "${l.resourcesPath}/js/passkeysConditionalAuth.js"; 5 const authButton = document.getElementById('${t}'); 6 const input = { 7 isUserIdentified : ${g}, 8 challenge : ${JSON.stringify(d)}, 9 userVerification : ${JSON.stringify(e)}, 10 rpId : ${JSON.stringify(c)}, 11 createTimeout : ${a} 12 }; 13 authButton.addEventListener("click", () => { 14 authenticateByWebAuthn({ 15 ...input, 16 errmsg : ${JSON.stringify(u("webauthn-unsupported-browser-text"))} 17 }); 18 }, { once: true }); 19 20 initAuthenticate({ 21 ...input, 22 errmsg : ${JSON.stringify(u("passkey-unsupported-browser-text"))} 23 }); 24 `}]});y.useEffect(()=>{p||o.enableWebAuthnConditionalUI!==!0||(async()=>(await L({elementId:t}),j()))()},[p])}function H(h){var t;const{kcContext:o,i18n:i,doUseDefaultCss:l,Template:g,classes:d}=h,{kcClsx:e}=B({doUseDefaultCss:l,classes:d}),{social:c,realm:a,url:u,usernameHidden:p,login:j,auth:v,registrationDisabled:N,messagesPerField:m,enableWebAuthnConditionalUI:C,authenticators:x}=o,{msg:n,msgStr:w}=i,[F,S]=y.useState(!1),f="authenticateWebAuthnButton";return P({webAuthnButtonId:f,kcContext:o,i18n:i}),s.jsxs(g,Object.assign({kcContext:o,i18n:i,doUseDefaultCss:l,classes:d,displayMessage:!m.existsError("username","password"),headerNode:n("loginAccountTitle"),displayInfo:a.password&&a.registrationAllowed&&!N,infoNode:s.jsx("div",Object.assign({id:"kc-registration-container"},{children:s.jsx("div",Object.assign({id:"kc-registration"},{children:s.jsxs("span",{children:[n("noAccount")," ",s.jsx("a",Object.assign({tabIndex:8,href:u.registrationUrl},{children:n("doRegister")}))]})}))})),socialProvidersNode:s.jsx(s.Fragment,{children:a.password&&(c==null?void 0:c.providers)!==void 0&&c.providers.length!==0&&s.jsxs("div",Object.assign({id:"kc-social-providers",className:e("kcFormSocialAccountSectionClass")},{children:[s.jsx("hr",{}),s.jsx("h2",{children:n("identity-provider-login-label")}),s.jsx("ul",Object.assign({className:e("kcFormSocialAccountListClass",c.providers.length>3&&"kcFormSocialAccountListGridClass")},{children:c.providers.map((...[r,,b])=>s.jsx("li",{children:s.jsxs("a",Object.assign({id:`social-${r.alias}`,className:e("kcFormSocialAccountListButtonClass",b.length>3&&"kcFormSocialAccountGridItem"),type:"button",href:r.loginUrl},{children:[r.iconClasses&&s.jsx("i",{className:I(e("kcCommonLogoIdP"),r.iconClasses),"aria-hidden":"true"}),s.jsx("span",{className:I(e("kcFormSocialAccountNameClass"),r.iconClasses&&"kc-social-icon-text"),dangerouslySetInnerHTML:{__html:k(r.displayName)}})]}))},r.alias))}))]}))})},{children:[s.jsx("div",Object.assign({id:"kc-form"},{children:s.jsx("div",Object.assign({id:"kc-form-wrapper"},{children:a.password&&s.jsxs("form",Object.assign({id:"kc-form-login",onSubmit:()=>(S(!0),!0),action:u.loginAction,method:"post"},{children:[!p&&s.jsxs("div",Object.assign({className:e("kcFormGroupClass")},{children:[s.jsx("label",Object.assign({htmlFor:"username",className:e("kcLabelClass")},{children:a.loginWithEmailAllowed?a.registrationEmailAsUsername?n("email"):n("usernameOrEmail"):n("username")}
24)),s.jsx("input",{tabIndex:2,id:"username",className:e("kcInputClass"),name:"username",defaultValue:(t=j.username)!==null&&t!==void 0?t:"",type:"text",autoFocus:!0,autoComplete:C?"username webauthn":"username","aria-invalid":m.existsError("username","password")}),m.existsError("username","password")&&s.jsx("span",{id:"input-error",className:e("kcInputErrorMessageClass"),"aria-live":"polite",dangerouslySetInnerHTML:{__html:k(m.getFirstError("username","password"))}})]})),s.jsxs("div",Object.assign({className:e("kcFormGroupClass")},{children:[s.jsx("label",Object.assign({htmlFor:"password",className:e("kcLabelClass")},{children:n("password")})),s.jsx(M,Object.assign({kcClsx:e,i18n:i,passwordInputId:"password"},{children:s.jsx("input",{tabIndex:3,id:"password",className:e("kcInputClass"),name:"password",type:"password",autoComplete:"current-password","aria-invalid":m.existsError("username","password")})})),p&&m.existsError("username","password")&&s.jsx("span",{id:"input-error",className:e("kcInputErrorMessageClass"),"aria-live":"polite",dangerouslySetInnerHTML:{__html:k(m.getFirstError("username","password"))}})]})),s.jsxs("div",Object.assign({className:e("kcFormGroupClass","kcFormSettingClass")},{children:[s.jsx("div",Object.assign({id:"kc-form-options"},{children:a.rememberMe&&!p&&s.jsx("div",Object.assign({className:"checkbox"},{children:s.jsxs("label",{children:[s.jsx("input",{tabIndex:5,id:"rememberMe",name:"rememberMe",type:"checkbox",defaultChecked:!!j.rememberMe})," ",n("rememberMe")]})}))})),s.jsx("div",Object.assign({className:e("kcFormOptionsWrapperClass")},{children:a.resetPasswordAllowed&&s.jsx("span",{children:s.jsx("a",Object.assign({tabIndex:6,href:u.loginResetCredentialsUrl},{children:n("doForgotPassword")}))})}))]})),s.jsxs("div",Object.assign({id:"kc-form-buttons",className:e("kcFormGroupClass")},{children:[s.jsx("input",{type:"hidden",id:"id-hidden-input",name:"credentialId",value:v.selectedCredential}),s.jsx("input",{tabIndex:7,disabled:F,className:e("kcButtonClass","kcButtonPrimaryClass","kcButtonBlockClass","kcButtonLargeClass"),name:"login",id:"kc-login",type:"submit",value:w("doLogIn")})]}))]}))}))})),C&&s.jsxs(s.Fragment,{children:[s.jsxs("form",Object.assign({id:"webauth",action:u.loginAction,method:"post"},{children:[s.jsx("input",{type:"hidden",id:"clientDataJSON",name:"clientDataJSON"}),s.jsx("input",{type:"hidden",id:"authenticatorData",name:"authenticatorData"}),s.jsx("input",{type:"hidden",id:"signature",name:"signature"}),s.jsx("input",{type:"hidden",id:"credentialId",name:"credentialId"}),s.jsx("input",{type:"hidden",id:"userHandle",name:"userHandle"}),s.jsx("input",{type:"hidden",id:"error",name:"error"})]})),x!==void 0&&x.authenticators.length!==0&&s.jsx(s.Fragment,{children:s.jsx("form",Object.assign({id:"authn_select",className:e("kcFormClass")},{children:x.authenticators.map((r,b)=>s.jsx("input",{type:"hidden",name:"authn_use_chk",readOnly:!0,value:r.credentialId},b))}))}),s.jsx("br",{}),s.jsx("input",{id:f,type:"button",className:e("kcButtonClass","kcButtonDefaultClass","kcButtonBlockClass","kcButtonLargeClass"),value:w("passkey-doAuthenticate")})]})]}))}function M(h){const{kcClsx:t,i18n:o,passwordInputId:i,children:l}=h,{msgStr:g}=o,{isPasswordRevealed:d,toggleIsPasswordRevealed:e}=A({passwordInputId:i});return s.jsxs("div",Object.assign({className:t("kcInputGroup")},{children:[l,s.jsx("button",Object.assign({type:"button",className:t("kcFormPasswordVisibilityButtonClass"),"aria-label":g(d?"hidePassword":"showPassword"),"aria-controls":i,onClick:e},{children:s.jsx("i",{className:t(d?"kcFormPasswordVisibilityIconHide":"kcFormPasswordVisibilityIconShow"),"aria-hidden":!0})}))]}))}export{H as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.