(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[973],{1522:function(e,s,r){Promise.resolve().then(r.bind(r,848))},848:function(e,s,r){"use strict";r.r(s);var t=r(7821),a=r(9164),n=r(3153),o=r(6712),i=r(1736),d=r(8676),l=r(3984),u=r(615),c=r(7558),m=r(5231),p=r(1853),g=r(9881),f=r(4089),v=r(8504),h=r(8078),x=r(746),w=r(9912);let b=()=>{let{projectName:e}=(0,h.useContext)(u.c),s=(0,v.useSearchParams)().get("email"),r=(0,v.useRouter)(),[b,j]=(0,h.useState)(!1),_=w.ZP.object({email:w.ZP.string({required_error:"Veuillez renseigner l'adresse email"}),old_password:w.ZP.string({required_error:"Veuillez renseigner votre mot de passe actuel"}),new_password:g.r}),y=(0,x.cI)({resolver:(0,f.F)(_),mode:"onChange",defaultValues:{email:null!=s?s:""}});async function N(e){try{j(!0);let s=await (0,a.SSm)({body:{email:e.email,old_password:e.old_password,new_password:e.new_password}});if(j(!1),s.response.status<300){r.push("/change-password/success");return}(0,p.Am)({title:"Erreur",description:s.error.detail,variant:"destructive"})}catch(e){j(!1),(0,p.Am)({title:"Erreur",description:"".concat(e),variant:"destructive"})}}return(0,t.jsx)(n.G,{title:"Modifier le mot de passe ".concat(e),description:"Entrez votre ancien puis nouveau mot de passe",children:(0,t.jsx)(c.l0,{...y,children:(0,t.jsx)("form",{onSubmit:y.handleSubmit(N),children:(0,t.jsxs)("div",{className:"grid gap-4",children:[(0,t.jsx)(o.T,{form:y,name:"email",label:"Email",render:e=>(0,t.jsx)(m.I,{placeholder:"prenom.nom@etu.ec-lyon.fr",...e})}),(0,t.jsx)(o.T,{form:y,name:"old_password",label:"Ancien mot de passe",render:e=>(0,t.jsx)(d.W,{autoFocus:!0,...e})}),(0,t.jsx)(o.T,{form:y,name:"new_password",label:"Nouveau mot de passe",render:e=>(0,t.jsx)(l.S,{...e})}),(0,t.jsx)(i.f,{type:"submit",className:"mt-2 w-full",label:"Modifier le mot de passe",isLoading:b})]})})})})};s.default=()=>(0,t.jsx)(h.Suspense,{children:(0,t.jsx)(b,{})})},8676:function(e,s,r){"use strict";r.d(s,{W:function(){return d}});var t=r(7821),a=r(5231),n=r(7211),o=r(8078),i=r(6963);let d=o.forwardRef((e,s)=>{let{className:r,...d}=e,[l,u]=o.useState(!1),c=()=>u(!l);return(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(a.I,{type:l?"text":"password",className:(0,n.cn)(r),ref:s,...d}),(0,t.jsx)("div",{className:"absolute inset-y-0 right-0 flex cursor-pointer items-center pr-3 text-gray-400 hover:text-[hsl(var(--primary))]",children:l?(0,t.jsx)(i.Rbo,{className:"h-4 w-4",onClick:c}):(0,t.jsx)(i.MBb,{className:"h-4 w-4",onClick:c})})]})});d.displayName="PasswordInput"},3984:function(e,s,r){"use strict";r.d(s,{S:function(){return i}});var t=r(7821),a=r(8676),n=r(5374),o=r(8078);let i=o.forwardRef((e,s)=>{let{...r}=e,[i,d]=o.useState(0),l=r.onChange;return r.onChange=e=>{l&&(d((0,n.tu)(e.target.value).score),l(e))},(0,t.jsxs)("div",{children:[(0,t.jsx)(a.W,{...r,ref:s}),(0,t.jsx)("div",{className:"grid grid-flow-col justify-stretch gap-4 mt-4 px-1",children:[void 0,void 0,void 0,void 0,void 0].map((e,s)=>{var a,n;return(0,t.jsx)("div",{className:"px-1 h-2 rounded-xl transition-colors ".concat((null===(n=r.value)||void 0===n?void 0:null===(a=n.toString())||void 0===a?void 0:a.length)&&!(i<s)?["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-400","bg-green-400"][i]:"bg-gray-200")},s)})})]})});i.displayName="PasswordInputWithStrength"},9881:function(e,s,r){"use strict";r.d(s,{r:function(){return u}});var t=r(5374),a=r(6574),n=r(4814),o=r(7932),i=r(7028),d=r(9912);let l={translations:o.Z,graphs:a.x,dictionary:{...a.F,...n.F,...i.F}};t.Mu.setOptions(l);let u=d.z.string({required_error:"Le mot de passe n'est pas assez fort"}).superRefine((e,s)=>{let r=(0,t.tu)(e||"");r.score>=4||(r.feedback.warning?s.addIssue({code:d.z.ZodIssueCode.custom,message:r.feedback.warning}):r.feedback.suggestions.length?s.addIssue({code:d.z.ZodIssueCode.custom,message:r.feedback.suggestions[0]}):s.addIssue({code:d.z.ZodIssueCode.custom,message:"Le mot de passe n'est pas assez fort"}))})}},function(e){e.O(0,[322,382,314,726,393,792,819,874,390,305,340,930,517,295,115,364,744],function(){return e(e.s=1522)}),_N_E=e.O()}]);