PageSourceSearch

https://www.pantryfy.ai/assets/LoginPage-Cs7csDTu.js

js pantryfy.ai collected 2026-10-05 14:58:57 UTC 4,362 bytes, 1 lines download raw bytes

1import{u as I,an as L,n as F,ao as U,r as A,z as G,j as e,Y as w,l as S,L as u,V as T}from"./index-OkrqJvG1.js";import{A as $,N as q,a as z,O as Y}from"./AuthShell-BvMGHEZh.js";import{a as C}from"./auth-CKrNohl9.js";import{s as B,a as M}from"./oauthReturn-BYpMZQx6.js";import{u as H}from"./useCanonical-BcdI0bSj.js";import{A as V,P as W}from"./storeLinks-CQIfuATr.js";function se(){H("/login",{noindex:!0});const k=I(),[i]=L(),R=F(s=>s.setAuth),o=U(),[l,_]=A.useState({email:"",password:""}),[r,a]=A.useState(i.get("reason")==="account-removed"?"This account is no longer available. Please sign up to create a new one.":null),m=i.get("next"),D=`/register${m?`?next=${encodeURIComponent(m)}`:""}`,c=G({mutationFn:C.login,onSuccess:s=>{R(s.user,s.access_token,s.refresh_token);const t=M(i.get("next"));k(t??"/",{replace:!0})},onError:s=>{var p,f,h,x,j,v,y,b;const t=s;if(((p=t.response)==null?void 0:p.status)===401)a("Invalid email or password. Please try again.");else if(((f=t.response)==null?void 0:f.status)===429)a("Too many login attempts. Please wait a moment and try again.");else if(((h=t.response)==null?void 0:h.status)===403)a("Your account has been locked. Please contact support.");else if(((x=t.response)==null?void 0:x.status)===422){const n=(v=(j=t.response)==null?void 0:j.data)==null?void 0:v.detail;if(Array.isArray(n)&&n.length>0){const d=n[0],P=Array.isArray(d.loc)?d.loc.filter(O=>O!=="body").join("."):"",N=d.msg??"Invalid input";a(P?`${P}: ${N}`:N)}else a(typeof n=="string"?n:"Please check your email and password and try again.")}else{const n=(b=(y=t.response)==null?void 0:y.data)==null?void 0:b.detail;a(typeof n=="string"?n:"Unable to connect. Please check your internet connection.")}}}),E=s=>{s.preventDefault(),!o&&(a(null),c.mutate(l))},g=s=>{_(t=>({...t,[s.target.name]:s.target.value})),r&&a(null)};return e.jsxs($,{title:"Welcome back",description:e.jsxs(e.Fragment,{children:["Don't have an account?"," ",e.jsx(u,{to:D,className:"rounded-sm font-semibold text-primary-text underline-offset-2 hover:underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",children:"Sign up"})]}),footer:e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-caption text-foreground-secondary",children:["New to Pantryfy?"," ",e.jsx(u,{to:"/about",className:"font-semibold text-primary-text underline-offset-2 hover:underline",children:"See what it does"})]}),e.jsxs("div",{className:"mt-4 grid justify-items-center gap-3",children:[e.jsx("p",{className:"text-caption text-foreground-secondary",children:"Also on iPhone and Android"}),e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-3",children:[e.jsx("a",{href:V,"aria-label":"Download Pantryfy on the App Store",target:"_blank",rel:"noopener noreferrer",children:e.jsx("img",{src:"/badges/app-store-badge.svg",alt:"Download on the App Store",className:"h-10"})}),e.jsx("a",{href:W,"aria-label":"Get Pantryfy on Google Play",target:"_blank",rel:"noopener noreferrer",children:e.jsx("img",{src:"/badges/google-play-badge.svg",alt:"Get it on Google Play",className:"h-10"})})]})]})]}),children:[e.jsxs("form",{onSubmit:E,className:"grid gap-5",children:[e.jsx(w,{label:"Email address",type:"email",name:"email",autoComplete:"email",required:!0,value:l.email,onChange:g,"aria-invalid":r?!0:void 0}),e.jsxs("div",{className:"grid gap-1",children:[e.jsx(w,{label:"Password",type:"password",name:"password",autoComplete:"current-password",required:!0,value:l.password,onChange:g,"aria-invalid":r?!0:void 0}),e.jsx("div",{className:"flex justify-end",children:e.jsx(S,{asChild:!0,variant:"quiet",size:"sm",className:"-mr-3",children:e.jsx(u,{to:"/forgot-password",children:"Forgot password?"})})})]}),r&&e.jsxs(T,{tone:"danger",children:[e.jsx("span",{className:"font-semibold",children:"Couldn't sign you in."})," ",r]}),e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx(S,{type:"submit",size:"lg",block:!0,loading:c.isPending,disabled:o,disabledReason:o?"Needs a connection":void 0,children:c.isPending?"Signing in…":"Sign in"}),e.jsx(q,{show:o,className:"text-center"})]})]}),e.jsxs("div",{className:"mt-6 grid gap-5",children:[e.jsx(z,{}),e.jsx(Y,{onSelect:s=>{B(i.get("next")),window.location.href=C.getOAuthUrl(s)},disabled:o,disabledReason:o?"Needs a connection":void 0})]})]})}export{se 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.