PageSourceSearch

https://ketoach.com/assets/login-2ciI5V2K.js

js ketoach.com collected 2026-10-07 03:16:36 UTC 4,811 bytes, 1 lines download raw bytes

1import{G as e,o as t,q as n}from"./useStore-B9WcefOa.js";import{t as r}from"./link-BBhMEHqv.js";import{t as i}from"./loader-circle-Bo72W_Ua.js";import{Q as a,S as o,et as s,h as c}from"./index-CZxnGQ25.js";var l=n(e()),u=t(),d=`mt-2 h-12 w-full rounded-full border border-input bg-background px-5 text-sm outline-none placeholder:text-muted-foreground focus:ring-2 focus:ring-ring/30`;function f(){let e=s(),{redirect:t}=c.useSearch(),n=t??`/dashboard`,[f,p]=(0,l.useState)(`signin`),[m,h]=(0,l.useState)(``),[g,_]=(0,l.useState)(``),[v,y]=(0,l.useState)(``),[b,x]=(0,l.useState)(!1),[S,C]=(0,l.useState)(null),[w,T]=(0,l.useState)(null);(0,l.useEffect)(()=>{a.auth.getSession().then(({data:t})=>{t.session&&e({to:n,replace:!0})})},[e,n]);let E=e=>{p(e),C(null),T(null)};return(0,u.jsx)(o,{children:(0,u.jsxs)(`div`,{className:`mx-auto max-w-md rounded-3xl border border-border bg-card p-8 shadow-lift sm:p-10`,children:[(0,u.jsx)(`span`,{className:`eyebrow text-clay`,children:`Members`}),(0,u.jsx)(`h1`,{className:`mt-3 text-3xl`,children:f===`signin`?`Welcome back`:f===`signup`?`Create your account`:`Reset your password`}),(0,u.jsx)(`p`,{className:`mt-3 text-sm leading-relaxed text-muted-foreground`,children:f===`forgot`?`Enter your email address and we'll send you a link to choose a new password.`:`Your Ketoach account gives you access to the member dashboard.`}),(0,u.jsxs)(`form`,{className:`mt-8 space-y-5`,onSubmit:async t=>{if(t.preventDefault(),!b){x(!0),C(null),T(null);try{if(f===`signin`){let{error:t}=await a.auth.signInWithPassword({email:g,password:v});if(t)throw t;e({to:n,replace:!0});return}if(f===`signup`){let{data:t,error:r}=await a.auth.signUp({email:g,password:v,options:{emailRedirectTo:`${window.location.origin}${n}`,data:{first_name:m}}});if(r)throw r;if(t.session){e({to:n,replace:!0});return}T(`Almost there — check your email to confirm your account, then sign in.`);return}let{error:t}=await a.auth.resetPasswordForEmail(g,{redirectTo:`${window.location.origin}/reset-password`});if(t)throw t;T(`If that email is registered, a password reset link is on its way.`)}catch(e){C(e instanceof Error?e.message:`Something went wrong. Please try again in a moment.`)}finally{x(!1)}}},children:[f===`signup`&&(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`label`,{htmlFor:`first-name`,className:`text-sm font-medium text-foreground`,children:`First Name`}),(0,u.jsx)(`input`,{id:`first-name`,type:`text`,required:!0,autoComplete:`given-name`,value:m,onChange:e=>h(e.target.value),placeholder:`Sarah`,className:d})]}),(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`label`,{htmlFor:`login-email`,className:`text-sm font-medium text-foreground`,children:`Email Address`}),(0,u.jsx)(`input`,{id:`login-email`,type:`email`,required:!0,autoComplete:`email`,value:g,onChange:e=>_(e.target.value),placeholder:`[email protected]`,className:d})]}),f!==`forgot`&&(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`label`,{htmlFor:`login-password`,className:`text-sm font-medium text-foreground`,children:`Password`}),(0,u.jsx)(`input`,{id:`login-password`,type:`password`,required:!0,minLength:6,autoComplete:f===`signup`?`new-password`:`current-password`,value:v,onChange:e=>y(e.target.value),placeholder:`••••••••`,className:d})]}),S&&(0,u.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:S}),w&&(0,u.jsx)(`p`,{className:`text-sm font-medium text-primary`,children:w}),(0,u.jsxs)(`button`,{type:`submit`,disabled:b,className:`inline-flex h-12 w-full items-center justify-center gap-2 rounded-full bg-primary text-sm font-semibold text-primary-foreground transition-all hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-60`,children:[b&&(0,u.jsx)(i,{className:`h-4 w-4 animate-spin`}),f===`signin`?`Sign in`:f===`signup`?`Create account`:`Send reset link`]})]}),(0,u.jsxs)(`div`,{className:`mt-8 space-y-3 text-center text-sm text-muted-foreground`,children:[f===`signin`&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`p`,{children:(0,u.jsx)(`button`,{type:`button`,onClick:()=>E(`forgot`),className:`font-semibold text-primary underline-offset-4 hover:underline`,children:`Forgot your password?`})}),(0,u.jsxs)(`p`,{children:[`New to Ketoach?`,` `,(0,u.jsx)(`button`,{type:`button`,onClick:()=>E(`signup`),className:`font-semibold text-primary underline-offset-4 hover:underline`,children:`Create an account`})]})]}),f!==`signin`&&(0,u.jsxs)(`p`,{children:[`Already have an account?`,` `,(0,u.jsx)(`button`,{type:`button`,onClick:()=>E(`signin`),className:`font-semibold text-primary underline-offset-4 hover:underline`,children:`Sign in`})]}),(0,u.jsxs)(`p`,{children:[`Curious what's coming?`,` `,(0,u.jsx)(r,{to:`/community`,className:`font-semibold text-primary underline-offset-4 hover:underline`,children:`Explore the community`})]})]})]})})}export{f as component};

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.