1import{r as e,a as s,i as a,d as t,j as r,F as o,L as i,e as l,N as n,t as c,s as d,a3 as p,m as u,B as m,n as h}from"./index-r-KClxtY.js";import{H as g}from"./HelpText-djUlMn1P.js";import{F as w}from"./Form-BVeuzoPa.js";/* empty css */import"./Toast-DuPXoAKZ.js";/* empty css */const v=p=>{const[u,m]=e.useState(),[h,g]=e.useState(),[v,f]=e.useState(!1),_=p.texts,{addNotice:x}=s(),y=a(),j=p.setFormState,N={inputs:{username:{label:_.email_username,tag:"input",className:"username",type:"text",placeholder:_.email_username,regOptions:{required:{value:!0,message:_.validation.required}}}},defaultValues:{username:""}},b=t({defaultValues:N.defaultValues,mode:"onChange",criteriaMode:"all"});return r.jsx("div",{className:"LostPasswordForm-wrapper PageForm-wrapper",children:r.jsxs(o,{...b,children:[r.jsx(w,{schema:N,name:"LostPasswordForm",onSubmit:e=>{if(!u)return console.log("captchaToken non presente");if(!h)return console.log("identityToken non presente");f(!0);const s={...e,"g-recaptcha-response":u,rcpt:h};return l("/api/user/recover-password",s).then((s=>{!1===s.data.success?(x({title:c.notices.generic_error,type:n.error,timeout:15e3}),y("/sso/login")):!0===s.data.success&&(x({title:c.notices.mail_sent_successfully,type:n.success,timeout:15e3}),d.username=e.username,j("success"))})).catch((e=>{x({title:c.notices.generic_error,type:n.error,timeout:1e4})})).finally((()=>{f(!1)}))},cta:p.cta,methods:b,alertMessage:_.alertMessage,recaptcha:!0,setToken:m,setIdentityToken:g,actionName:"acc_password"}),v&&r.jsx(i,{spinner:!0,labelPrimary:"",labelSecondary:""})]})})},f=u=>{const m=p(d),[h,g]=e.useState(),[v,f]=e.useState(),[_,x]=e.useState(!1),{addNotice:y}=s(),j=a(),N=u.texts,b={inputs:{username:{label:N.email_username,tag:"input",className:"username",type:"hidden",placeholder:N.email_username,regOptions:{required:{value:!0,message:N.validation.required}}},verify_code:{label:N.verify_code,tag:"input",className:"verify-code",type:"text",placeholder:N.verify_code,regOptions:{required:{value:!0,message:N.validation.required}}},new_password:{label:N.password,tag:"input",className:"password",type:"password",placeholder:"Password",regOptions:{required:{value:!0,message:N.validation.required},minLength:{value:8,message:N.validation.minLength},validationRules:[{type:"hasLowerUpper"},{type:"hasNumber"},{type:"hasSpecialChar"}]},validationTitle:N.validation.pwdValidationTitle,validationMessages:{minLength:N.validation.minLength,hasLowerUpper:N.validation.hasLowerUpper,hasNumber:N.validation.hasNumber,hasSpecialChar:N.validation.hasSpecialChar}},password_confirm:{label:N.password_confirm,tag:"input",className:"password-confirm",type:"password",placeholder:"Password",regOptions:{required:{value:!0,message:N.validation.required},validationRules:[{type:"isMatch",value:"new_password"}]}}},defaultValues:{username:m.username,verify_code:"",new_password:"",password_confirm:""}},S=t({defaultValues:b.defaultValues,mode:"onChange",criteriaMode:"all"});return r.jsxs("div",{className:"ResetPasswordForm-wrapper PageForm-wrapper",children:[_&&r.jsx(i,{}),r.jsx(o,{...S,children:r.jsx(w,{schema:b,name:"ResetPasswordForm",onSubmit:e=>{if(!h)return console.log("captchaToken non presente");if(!v)return console.log("identityToken non presente");x(!0);const s={...e,"g-recaptcha-response":h,rcpt:v};return l("/api/user/reset-password",s).then((e=>{!1===e.data.success?y({title:c.notices.generic_error,type:n.error,timeout:15e3}):!0===e.data.success&&(d.username=null,y({title:c.notices.password_changed,type:n.success,timeout:15e3}),j("/sso/login"))})).catch((e=>{y({title:c.notices.generic_error,type:n.error,timeout:15e3})})).finally((()=>{x(!1)}))},cta:u.cta,methods:S,alertMessage:N.alertMessage,recaptcha:!0,setToken:g,setIdentityToken:f,actionName:"acc_password"})})]})},_=()=>{p(d);const{loginChallenge:s}=u(),a=c.user,t=c.common,[o,i]=e.useState("fillable");return r.jsx("div",{className:"LostPassword-wrapper route-wrapper",children:r.jsxs("div",{className:"auth-wrapper",children:[r.jsx("h1",{className:"page-title centered",children:"fillable"===o?a.titles.lost_password:"success"===o?a.titles.check_email:a.titles.invalid_link}),r.jsx("div",{className:"LostPassword-text",children:"fillable"===o?a.lost_password_text:"success"===o?a.check_email_text:a.invalid_link_text}),"fillable"===o&&r.jsx(v,{cta:t.forms.recoverCta,texts:t.forms,loginChallenge:s,setFormState:i}),"success"===o&&r.jsx("div",{className:"LostPassword-success",children:r.jsx(f,{cta:t.forms.recoverCta,texts:t.forms,loginChallenge:s})}),"failed"===o&&r.jsx(m,{label:t.forms.recoverPwdCta,color:"cta"}),r.jsx("div",{children:r.jsx(h,{to:"/sso/login",children:a.go_to_login})}),r.jsx(g,{label:t.help.label,url:t.help.url,cta:t.help.cta})]})})};export{_ 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.