PageSourceSearch

https://flows.super.ai/assets/set-password-DBue-8iZ.js

js super.ai collected 2026-09-25 18:17:21 UTC 7,541 bytes, 3 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="4151de60-14bd-4138-93bf-eca617c6e53d")}catch(e){}}();import{c as k,j as s,B as j,c3 as K,c4 as g,u as D,c6 as U,cu as z,r as w,I as B,c5 as A,cn as O,a as X,L as Y,aN as $}from"./index-BFiNvylu.js";import{R as V,S as p,a as F}from"./ResendInvitationPanel-BSBhJACJ.js";import{C as T,a as _,b as y,d as b,c as P}from"./card-B9yqEqNl.js";import{u as H,a as W,F as q,b as N,c as S,d as E,e as I,g as L}from"./form-Bw3S76bS.js";import{A as G}from"./AssentNotice-CAZUU26j.js";import{P as R}from"./password-input-EYdxXgfM.js";import"./label-3D9CUkkK.js";import"./eye-off-Zz4QHTam.js";import"./eye-C69H_dq1.js";const M="Link Expired";function Z(t){const e=k.c(17),{inviteToken:a,onNavigateToLogin:o,description:l,title:m}=t,i=m===void 0?M:m;let r;e[0]!==i?(r=s.jsx(T,{className:"text-xl",children:i}),e[0]=i,e[1]=r):r=e[1];let n;e[2]!==l?(n=s.jsx(_,{children:l}),e[2]=l,e[3]=n):n=e[3];let u;e[4]!==r||e[5]!==n?(u=s.jsxs(y,{className:"text-center",children:[r,n]}),e[4]=r,e[5]=n,e[6]=u):u=e[6];let x;e[7]!==a?(x=s.jsx(b,{children:s.jsx("div",{className:"space-y-4",children:s.jsx(V,{inviteToken:a})})}),e[7]=a,e[8]=x):x=e[8];let c;e[9]!==u||e[10]!==x?(c=s.jsxs(P,{children:[u,x]}),e[9]=u,e[10]=x,e[11]=c):c=e[11];let h;e[12]!==o?(h=s.jsx("div",{className:"text-center",children:s.jsx(j,{variant:"link",onClick:o,children:"Back to Login"})}),e[12]=o,e[13]=h):h=e[13];let d;return e[14]!==c||e[15]!==h?(d=s.jsxs("div",{className:"flex flex-col gap-6",children:[c,h]}),e[14]=c,e[15]=h,e[16]=d):d=e[16],d}function J(t){const e=k.c(9),{inviteToken:a,onNavigateToLogin:o}=t;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs(y,{className:"text-center",children:[s.jsx(T,{className:"text-xl",children:"Invalid Link"}),s.jsx(_,{children:"The link you used is invalid or has been corrupted."})]}),e[0]=l):l=e[0];let m;e[1]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx("p",{className:"text-sm text-yellow-800",children:"Having trouble with your invitation link?"}),e[1]=m):m=e[1];let i;e[2]!==a?(i=s.jsxs(P,{children:[l,s.jsx(b,{children:s.jsxs("div",{className:"mt-4 space-y-3 p-4 bg-yellow-50 border border-yellow-200 rounded-md",children:[m,s.jsx(V,{inviteToken:a})]})})]}),e[2]=a,e[3]=i):i=e[3];let r;e[4]!==o?(r=s.jsx("div",{className:"text-center",children:s.jsx(j,{variant:"link",onClick:o,children:"Back to Login"})}),e[4]=o,e[5]=r):r=e[5];let n;return e[6]!==i||e[7]!==r?(n=s.jsxs("div",{className:"flex flex-col gap-6",children:[i,r]}),e[6]=i,e[7]=r,e[8]=n):n=e[8],n}const Q=K({email:g().email({message:"Please enter a valid email address."}),new_password:g().min(8,{message:"Password must be at least 8 characters."}),confirm_password:g().min(8,{message:"Password must be at least 8 characters."})}).refine(t=>t.new_password===t.confirm_password,{message:"Passwords don't match",path:["confirm_password"]});function ee({userEmail:t,onNavigateToLogin:e}){const a=D(),o=U(),l=z(),[m,i]=w.useState(!1),[r,n]=w.useState(null),[u,x]=w.useState(null),c=H({resolver:W(Q),defaultValues:{email:t,new_password:"",confirm_password:""}});async function h(d){try{i(!0),n(null),x(null);const{error:f}=await A.auth.updateUser({password:d.new_password});if(f)throw new Error(f.message||"Failed to set password");try{await l.mutateAsync({data:{}})}catch(C){console.warn("Could not record terms acceptance",C)}x("Password set successfully! Welcome!"),c.reset(),setTimeout(()=>{const v=new URLSearchParams(window.location.search).get("redirect");if(v&&O(v))return a({to:v});a({to:"/"})},1e3)}catch(f){console.error("Password set failed:",f),n(f instanceof Error?f.message:"Failed to set password")}finally{i(!1)}}return s.jsxs("div",{className:"flex flex-col gap-6",children:[s.jsxs(P,{children:[s.jsxs(y,{className:"text-center",children:[s.jsx(T,{className:"text-xl",children:"Set Your Password"}),s.jsx(_,{children:"Enter your email and create a new password for your account"})]}),s.jsx(b,{children:s.jsx(q,{...c,children:s.jsxs("form",{onSubmit:c.handleSubmit(h),className:"space-y-4",children:[s.jsx(N,{control:c.control,name:"email",render:({field:d})=>s.jsxs(S,{children:[s.jsx(E,{children:"Email"}),s.jsx(I,{children:s.jsx(B,{placeholder:"[email protected]",...d,disabled:!0})}),s.jsx(L,{})]})}),s.jsx(N,{control:c.control,name:"new_password",render:({field:d})=>s.jsxs(S,{children:[s.jsx(E,{children:"New Password"}),s.jsx(I,{children:s.jsx(R,{placeholder:"Create a new password",...d})}),s.jsx(L,{})]})}),s.jsx(N,{control:c.control,name:"confirm_password",render:({field:d})=>s.jsxs(S,{children:[s.jsx(E,{children:"Confirm Password"}),s.jsx(I,{children:s.jsx(R,{placeholder:"Confirm your password",...d})}),s.jsx(L,{})]})}),s.jsx(G,{docs:o,"data-e2e-id":"set-password-assent"}),r&&s.jsx("div",{className:"text-sm text-red-500 font-medium",children:r}),u&&s.jsx("div",{className:"text-sm text-green-500 font-medium",children:u}),s.jsx(j,{type:"submit",className:"w-full",disabled:m,children:m?"Setting password...":"Set Password"})]})})})]}),s.jsx("div",{className:"text-center",children:s.jsx(j,{variant:"link",onClick:e,children:"Back to Login"})})]})}
1const se=["otp_expired","access_denied"];function te(){if(typeof window>"u")return!1;const t=new URLSearchParams(window.location.hash.replace(/^#/,"")),e=t.get("error_code")??t.get("error");return e!==null&&se.includes(e)}function re(){const t=D(),e=X({from:"/(authentication)/set-password"}),[a,o]=w.useState({userEmail:"",inviteToken:null,viewState:p.INITIALIZING});w.useEffect(()=>{(async()=>{try{const{verified:i,reason:r}=e;if(i){const{data:{user:n}}=await A.auth.getUser();if(n?.email){o({userEmail:n.email,inviteToken:null,viewState:p.VALID_TOKEN});return}else{o({userEmail:"",inviteToken:null,viewState:p.EXPIRED_LINK,title:"Session Expired",error:"Your session has expired. Sign in again to continue - your invitation has already been used."});return}}r==="expired"||te()?o({userEmail:"",inviteToken:F(),viewState:p.EXPIRED_LINK,error:"Your invitation link has expired. This happens for security reasons. Request a fresh one below to continue."}):o({userEmail:"",inviteToken:F(),viewState:p.INVALID_LINK,error:"Invalid or missing invitation token"})}catch(i){console.error("Session initialization failed:",i),o({userEmail:"",inviteToken:null,viewState:p.INVALID_LINK,error:"Failed to initialize session"})}})()},[t,e]);const l=()=>{t({to:"/signin",search:e.redirect?{redirect:e.redirect}:void 0})};switch(a.viewState){case p.VALID_TOKEN:return s.jsx(ee,{userEmail:a.userEmail,onNavigateToLogin:l});case p.EXPIRED_LINK:return s.jsx(Z,{inviteToken:a.inviteToken,onNavigateToLogin:l,title:a.title,description:a.error??""});case p.INVALID_LINK:return s.jsx(J,{inviteToken:a.inviteToken,onNavigateToLogin:l});default:return s.jsx(Y,{})}}function ae(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex min-h-svh flex-col items-center justify-center gap-6 bg-muted p-6 md:p-10",children:s.jsxs("div",{className:"flex w-full max-w-sm flex-col gap-6",children:[s.jsxs($,{to:"/",className:"flex flex-row items-center gap-2 self-center font-medium",children:[s.jsx("img",{src:"/superai-logo.webp",alt:"Super.AI",className:"size-12"}),"Super.AI Flows"]}),s.jsx(re,{})]})}),t[0]=e):e=t[0],e}const pe=ae;export{pe as component};
2
3//# chunkId=4151de60-14bd-4138-93bf-eca617c6e53d

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.