PageSourceSearch

https://nya.yobber.se/assets/ResetPassword-eSldvvTV.js

js yobber.se collected 2026-10-08 09:57:17 UTC 7,398 bytes, 1 lines download raw bytes

1import{r,c as de,e as me,j as e}from"./vendor-react-CbEgFW7o.js";import{b7 as ue,df as xe,dg as he,cZ as pe,C as f,x as w,y,z as j,j as g,B as v,b9 as fe,S as H,L as Y,J as Q,c_ as q,ac as W,dh as we,c$ as ye,d0 as X,d1 as je,d2 as ge,l as $,da as G,d4 as ve,di as be,d5 as Ne}from"./main-CNvMvyJ0.js";import{D as Pe}from"./index-DU97bhtr.js";const ke="https://ohwhrgzctyrovewaafmv.supabase.co",Se="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9od2hyZ3pjdHlyb3Zld2FhZm12Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzM2NDQ0NTgsImV4cCI6MjA4OTIyMDQ1OH0.AUO1devzQS15MmShwJCvfFnidalpbvAws7P6R8Yo2WE",Ce=s=>ye({password:X().min(je,s("validation:passwordMin")).max(72,s("validation:passwordMax")).refine(ge,s("validation:passwordCharacters")),confirmPassword:X().min(1,s("validation:confirmPasswordRequired"))}).refine(m=>m.password===m.confirmPassword,{message:s("validation:passwordsMismatch"),path:["confirmPassword"]});function Le(){var Z,B;const{t:s,i18n:m}=Pe(["auth","validation"]),[b,K]=r.useState(!1),[N,ee]=r.useState(!1),[E,L]=r.useState(!1),[T,A]=r.useState(!1),[O,u]=r.useState(null),[M,_]=r.useState(!1),[V,P]=r.useState(null),[se,J]=r.useState(!1),[F,re]=r.useState(null),x=de(),[h]=me(),{isCompanyLanding:te,getPath:ae}=ue(),k=t=>te?ae(t):t,S=h.get("token_hash"),oe=h.get("type"),p=h.get("reinvite_token"),U=!!S&&oe==="recovery"||!!p,C=!!p,c=xe(h.get("return_to")),z=c||k("/auth"),I=r.useMemo(()=>he(ke,Se,{auth:{storage:sessionStorage,persistSession:!0,autoRefreshToken:!1,storageKey:"sb-recovery-isolated"}}),[]),ne=r.useMemo(()=>Ce(s),[s,m.language]),a=pe({resolver:Ne(ne),defaultValues:{password:"",confirmPassword:""}}),ie=async()=>{var t,o,n,l;A(!0),u(null);try{if(C){const{data:i,error:D}=await $.functions.invoke("consume-employer-reinvite",{body:{token:p,action:"verify"}});if(D||i!=null&&i.error){const le=await G(D,i,s("resetPassword.errors.linkInvalidOrExpired"));u(le)}else _(!0);return}if(!S)return;const{data:R,error:d}=await I.auth.verifyOtp({token_hash:S,type:"recovery"});if(d){const i=(t=d.message)!=null&&t.includes("expired")?s("resetPassword.errors.linkExpired"):(o=d.message)!=null&&o.includes("already been used")||(n=d.message)!=null&&n.includes("invalid")?s("resetPassword.errors.linkInvalidOrUsed"):d.message;u(i)}else re(((l=R.user)==null?void 0:l.email)??null),_(!0)}catch{u(s("resetPassword.errors.unexpected"))}finally{A(!1)}},ce=async t=>{L(!0),P(null);try{if(C){const{data:n,error:l}=await $.functions.invoke("consume-employer-reinvite",{body:{token:p,password:t.password}});if(l||n!=null&&n.error){const R=await G(l,n,s("resetPassword.errors.updateFailed"));P(R)}else J(!0);return}const{error:o}=await I.auth.updateUser({password:t.password});o?P(ve(o)):(await I.auth.signOut(),J(!0))}finally{L(!1)}};if(!U&&!M)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-b from-background to-accent/20 px-4",children:e.jsxs(f,{className:"w-full max-w-md",translate:"no",children:[e.jsxs(w,{className:"text-center",children:[e.jsx(y,{className:"text-2xl",children:s("resetPassword.invalidLink.title")}),e.jsx(j,{children:s("resetPassword.invalidLink.description")})]}),e.jsx(g,{children:e.jsx(v,{onClick:()=>x(z),className:"w-full",children:s(c?"resetPassword.backToApplication":"resetPassword.toLogin")})})]})},"invalid-link");if(U&&!M)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-b from-background to-accent/20 px-4",children:e.jsxs(f,{className:"w-full max-w-md",translate:"no",children:[e.jsxs(w,{className:"text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-xl bg-primary text-primary-foreground",children:e.jsx(fe,{className:"h-6 w-6"})}),e.jsx(y,{className:"text-2xl",children:s("resetPassword.verify.title")}),e.jsx(j,{children:s("resetPassword.verify.description")})]}),e.jsxs(g,{className:"space-y-4",translate:"no",children:[e.jsx("p",{className:"text-sm text-destructive text-center",style:{display:O?"block":"none"},children:O||" "}),e.jsxs(v,{onClick:ie,className:"w-full",disabled:T,children:[T&&e.jsx(H,{className:"mr-2 h-4 w-4"}),s("resetPassword.verify.submit")]})]})]})},"verify-step");if(se){const t=()=>{const o=!C&&F?be(F):null;if(o){x(k("/auth")+"?"+new URLSearchParams({return_to:o}),{replace:!0});return}x(k("/auth"))};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-b from-background to-accent/20 px-4",children:e.jsxs(f,{className:"w-full max-w-md",translate:"no",children:[e.jsxs(w,{className:"text-center",children:[e.jsx(y,{className:"text-2xl",children:s("resetPassword.complete.title")}
1),e.jsx(j,{children:s(c?"resetPassword.complete.descriptionWithApplication":"resetPassword.complete.description")})]}),e.jsx(g,{children:e.jsx(v,{onClick:c?()=>x(z):t,className:"w-full",children:s(c?"resetPassword.backToApplication":"resetPassword.toLogin")})})]})},"reset-complete")}return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-b from-background to-accent/20 px-4",children:e.jsxs(f,{className:"w-full max-w-md",translate:"no",children:[e.jsxs(w,{className:"text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-xl bg-primary text-primary-foreground font-bold text-xl",children:"Y"}),e.jsx(y,{className:"text-2xl",children:s("resetPassword.form.title")}),e.jsx(j,{children:s("resetPassword.form.description")})]}),e.jsx(g,{children:e.jsxs("form",{onSubmit:a.handleSubmit(ce),className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-destructive text-center",style:{display:V?"block":"none"},children:V||" "}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Y,{htmlFor:"password",children:s("resetPassword.form.passwordLabel")}),e.jsxs("div",{className:"relative",children:[e.jsx(Q,{id:"password",type:b?"text":"password",placeholder:"••••••••",className:"pr-10",...a.register("password")}),e.jsx("button",{type:"button",onClick:()=>K(!b),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",tabIndex:-1,children:b?e.jsx(q,{className:"h-4 w-4"}):e.jsx(W,{className:"h-4 w-4"})})]}),e.jsx("p",{className:"text-sm text-destructive",style:{display:a.formState.errors.password?"block":"none"},children:((Z=a.formState.errors.password)==null?void 0:Z.message)||" "}),e.jsx(we,{password:a.watch("password")||"",className:"pt-1"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Y,{htmlFor:"confirmPassword",children:s("fields.confirmPassword")}),e.jsxs("div",{className:"relative",children:[e.jsx(Q,{id:"confirmPassword",type:N?"text":"password",placeholder:"••••••••",className:"pr-10",...a.register("confirmPassword")}),e.jsx("button",{type:"button",onClick:()=>ee(!N),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",tabIndex:-1,children:N?e.jsx(q,{className:"h-4 w-4"}):e.jsx(W,{className:"h-4 w-4"})})]}),e.jsx("p",{className:"text-sm text-destructive",style:{display:a.formState.errors.confirmPassword?"block":"none"},children:((B=a.formState.errors.confirmPassword)==null?void 0:B.message)||" "})]}),e.jsxs(v,{type:"submit",className:"w-full",disabled:E,children:[E&&e.jsx(H,{className:"mr-2 h-4 w-4"}),s("resetPassword.form.submit")]})]})})]})},"password-form")}export{Le 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.