1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1387,7461],{31387:(e,r,s)=>{s.r(r),s.d(r,{config:()=>v,default:()=>Y});var a=s(8501),t=s(33261),o=s(57283),i=s.n(o),n=s(81278),d=s(55729),c=s(57461),l=s(58e3),m=s(19655),u=s(54741),p=s(1909),h=s(30116),w=s(35460);let g={"/data/attributes/pass":"current_password"},y=({account:e})=>{let{t:r}=(0,l.useI18n)(),t=(0,n.useRouter)().locale,{csrfToken:o}=(0,l.useNode)(),[i,c]=(0,d.useState)(!1),{loginUrl:m}=(0,l.useAccount)(),{register:u,handleSubmit:y,setError:f,watch:x,formState:{errors:b}}=(0,p.mN)(),v=async a=>{let{toast:o}=await Promise.resolve().then(s.bind(s,5516));c(!0);let i=o.loading("Loading...");try{let r=await h.drupal.fetch(`${t}/api/user/user/${e.id}`,{withAuth:!0,method:"PATCH",body:JSON.stringify({data:{id:e.id,type:"user--user",attributes:{pass:{value:a.new_password,existing:a.current_password}}}})}),s=await r.json();r.ok?await (0,w.signOut)({callbackUrl:m}):(s?.errors||[]).forEach(e=>{let r=g[e?.source?.pointer]||void 0;r&&f(r,{type:"manual",message:e.detail})}),c(!1),o.dismiss(i)}catch(e){c(!1),o.dismiss(i),o.error(r("Une erreur s'est produite")),console.error(e)}};return(0,a.FD)("form",{onSubmit:y(v),children:[(0,a.Y)("input",{name:"_csrf",...u("_csrf"),type:"hidden",defaultValue:o}),(0,a.FD)("div",{className:"shadow sm:overflow-hidden sm:rounded-md",children:[(0,a.FD)("div",{className:"space-y-6 bg-white px-4 py-6 sm:p-6",children:[(0,a.FD)("div",{children:[(0,a.Y)("h3",{className:"text-lg font-medium leading-6 text-gray-900",children:"Password"}),(0,a.Y)("p",{className:"mt-1 text-sm text-gray-500",children:"Update you password."})]}),(0,a.Y)("div",{className:"grid grid-cols-6 gap-6",children:(0,a.FD)("div",{className:"col-span-6 sm:col-span-3",children:[(0,a.Y)("label",{htmlFor:"current-password",className:"block text-sm font-medium text-gray-700",children:"Current Password"}),(0,a.Y)("input",{type:"password",name:"current-password",id:"current-password",autoComplete:"given-name",className:"mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 shadow-sm focus:border-primary-500 focus:outline-none focus:ring-primary-500 sm:text-sm",...u("current_password",{required:"Current password is required"})}),b.current_password&&(0,a.Y)("p",{className:"text-red text-xs italic",children:b.current_password.message})]})}),(0,a.Y)("div",{className:"grid grid-cols-6 gap-6",children:(0,a.FD)("div",{className:"col-span-6 sm:col-span-3",children:[(0,a.Y)("label",{htmlFor:"new-password",className:"block text-sm font-medium text-gray-700",children:"New Password"}),(0,a.Y)("input",{type:"password",name:"new-password",id:"new-password",autoComplete:"given-name",className:"mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 shadow-sm focus:border-primary-500 focus:outline-none focus:ring-primary-500 sm:text-sm",...u("new_password",{required:"New password is required"})}),b.new_password&&(0,a.Y)("p",{className:"text-red text-xs italic",children:b.new_password.message})]})}),(0,a.Y)("div",{className:"grid grid-cols-6 gap-6",children:(0,a.FD)("div",{className:"col-span-6 sm:col-span-3",children:[(0,a.Y)("label",{htmlFor:"confirm-password",className:"block text-sm font-medium text-gray-700",children:"Confirm Password"}),(0,a.Y)("input",{type:"password",name:"confirm-password",id:"confirm-password",autoComplete:"given-name",className:"mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 shadow-sm focus:border-primary-500 focus:outline-none focus:ring-primary-500 sm:text-sm",...u("confirm_password",{required:"Confirm password is required",validate:e=>e===x("new_password")||"Le mot de passe est invalide."})}),b.confirm_password&&(0,a.Y)("p",{className:"text-red text-xs italic",children:b.confirm_password.message})]})})]}),(0,a.Y)("div",{className:"bg-gray-50 px-4 py-3 text-right sm:px-6",children:(0,a.Y)("button",{type:"submit",disabled:i,className:"inline-flex justify-center rounded-md border border-transparent bg-primary-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2",children:"Save"})})]})]})};var f=s(21454);let x=async e=>{localStorage.setItem("webauthnCredential",JSON.stringify(e))},b=()=>{let{t:e}=(0,l.useI18n)(),[r,t]=(0,d.useState)(!1),o=(0,l.useAccount)();(0,d.useEffect)(()=>{let e=JSON.parse(localStorage.getItem("webauthnCredential"));e?.id&&e?.uid&&t(!0)},[]);let i=async(r,a="test")=>{let{toast:t}=await Promise.resolve().then(s.bind(s,5516)),o=t.loading("Loading...");try{let s=await h.drupal.fetch(`api/user/user/${r}`,{withAuth:!0,method:"PATCH",body:JSON.stringify({data:{type:"user--user",id:r,attributes:{face_id:a}}})});s.ok&&(t.dismiss(o),t.success(e("Nx:Congrats! now you can authenticate using Face ID option!"))),s.ok||(t.dismiss(o),t.error(e("Nx:An error has been occurred while updating your profile, please try later!")))}catch(r){t.dismiss(o),t.error(e("Nx:An error has been occurred while updating your profile, please try later!"))}},n=async()=>{let e=o.profile.user.uuid;try{let r=await f.Sn.register(e,"a7c61ef9-dc23-4806-b486-2428938a547e",{authenticatorType:"auto",userVerification:"required",timeout:6e4,attestation:!1,debug:!1});return x({id:r.credential.id,uid:e}),i(e,r.credential.id),!0}catch(e){return console.error("faceid",e),!1}},c=async()=>{r?(localStorage.removeItem("webauthnCredential"),t(!1)):t(await n())};return(0,a.FD)("div",{className:"p-4 md:p-0",children:[(0,a.FD)("div",{className:"flex items-start justify-between gap-4",children:[(0,a.Y)(m.DZ,{level:"3",className:"mb-2",children:e("Nx:Parametrer biom\xe9trie")}),(0,a.Y)(m.lM,{value:r,setValue:c})]}),(0,a.Y)(m.EY,{children:e("Nx:Connectez-vous a votre espace par votre biom\xe9trie")})]})},v={id:"vactory_decoupled_espace_prive:account",lazy:!0},N=({children:e})=>{let r=(0,n.useRouter)(),{accountUrl:s}=(0,l.useAccount)(),{t}=(0,l.useI18n)(),o=r.query?.p||"account",i=[{name:"Account",href:s,icon:"user-circle",current:"account"===o},{name:"Password",href:`${s}?p=password`,icon:"key",current:"password"===o},{name:t("Biometerie"),href:`${s}?p=emprunt`,icon:"fingerprint",current:"emprunt"===o}];return(0,a.Y)("div",{className:"bg-gray-100",children:(0,a.Y)("div",{className:"mx-auto max-w-7xl py-6 sm:px-6 lg:px-8",children:(0,a.FD)("div",{className:"lg:grid lg:grid-cols-12 lg:gap-x-5",children:[(0,a.Y)("aside",{className:"px-2 py-6 sm:px-6 lg:col-span-3 lg:px-0 lg:py-0",children:(0,a.Y)("nav",{className:"space-y-1",children:i.map(e=>(0,a.FD)(m.N_,{href:e.href,className:(0,u.vclsx)(e.current?"bg-gray-50 text-primary-700 hover:bg-white hover:text-primary-700":"text-gray-900 hover:bg-gray-50 hover:text-gray-900","group flex items-center rounded-md px-3 py-2 text-sm font-medium"),"aria-current":e.current?"page":void 0,children:[(0,a.Y)(m.In,{id:e.icon,className:(0,u.vclsx)(e.current?"text-primary-500 group-hover:text-primary-500":"text-gray-400 group-hover:text-gray-500","-ml-1 mr-3 h-6 w-6 flex-shrink-0"),"aria-hidden":"true"}),(0,a.Y)("span",{className:"truncate",children:e.name})]},e.name))})}),(0,a.Y)("div",{className:"space-y-6 sm:px-6 lg:col-span-9 lg:px-0",children:e})]})})})},Y=({data:e})=>{let r=i()(e,"components.0.webform.id",null),s=i()(e,"components.0.webform.elements",null),o=i()(e,"components.0.webform.style",{}),d=i()(e,"components.0.webform.buttons",{}),m=((0,t.B)(i()(e,"components.0.user.data",{})).data??{})[0]??{},{isAuthenticated:u,updateUserSession:p}=(0,l.useAccount)(),h=(0,n.useRouter)(),w=h.query?.p||"account";return u?(0,a.FD)(N,{children:["account"===w&&(0,a.Y)(c.Form,{webformId:r,schema:s,styles:o,buttons:d,confirmeSubmit:async()=>{await p()},reset:!1}),"password"===w&&(0,a.Y)(y,{account:m}),"emprunt"===w&&(0,a.Y)(b,{})]}):null}},57461:(e,r,s)=>{s.r(r),s.d(r,{ConfirmationMessage:()=>d.F,Form:()=>a.Form,FormLayout:()=>n.H,FormMultiStep:()=>t.W,FormPreview:()=>i.VM,FormPreviewItem:()=>i.YA,FormPreviewItemValue:()=>i.DQ,FormStep:()=>t.$,FormStepper:()=>o.I,RenderField:()=>a.RenderField});var a=s(11968),t=s(87555),o=s(53153),i=s(97408),n=s(80670),d=s(91385)}}]);
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.