PageSourceSearch

https://app.vector.co/_nuxt/vheuUgaE.js

js vector.co collected 2026-09-28 07:33:06 UTC 10,329 bytes, 2 lines download raw bytes

1import{d as ke,L as he,R as be,S as Pe,U as Ce,V as Se,E as l,i as Re,j as Le,W as Ee,c as m,b as s,f as g,l as P,n as a,p as C,o as i,e as r,_ as Ue,t as h,s as Ie,X as H,F as Ve,r as Ae,k as T,M as X,q as z,z as De,C as O,Y as Z,Z as W,$ as Me}from"./BwFcdny1.js";import{_ as Fe}from"./BSJIKR69.js";import{_ as Te}from"./RWmWGzC7.js";import{_ as ze}from"./B38_szbe.js";import{_ as Be}from"./CJdCE0Uz.js";import{u as qe}from"./C2ZISsgu.js";import"./qHrqz7U0.js";const Ne={class:"relative min-h-screen flex items-center justify-center px-4 py-12"},$e={class:"w-full max-w-sm"},je={key:0,class:"mb-6 flex flex-col items-center gap-3"},Oe={class:"space-y-5 text-center"},We={class:"text-sm text-gray-500 mt-2"},Ge={class:"space-y-6"},Ke={key:0,class:"text-sm text-red-600 text-center"},Ye={class:"text-center"},Qe={class:"space-y-5 text-center"},He={class:"text-sm text-gray-500 mt-2"},Xe={class:"space-y-5"},Ze={key:0,class:"space-y-2"},Je={class:"flex items-center justify-between text-xs text-gray-500"},et={class:"font-medium text-gray-700"},tt={key:0,class:"text-xs text-red-600"},at={key:1,class:"text-sm text-red-600"},st={key:2,class:"rounded-lg bg-amber-100 p-3 text-sm text-amber-800 flex items-start gap-2"},lt={key:0,class:"text-center text-sm text-gray-500"},ft=ke({__name:"login",setup(ot){he({title:"Log in - Vector"});const B=be(),J=Pe(),ee=Ce().public,q=Se(),{loginWithGoogle:te,sendMagicLink:ae,startSsoLogin:se}=qe(),u=l(""),p=l(""),f=l(!1),w=l(!1),c=l(""),I=l(!1),y=l(Array(6).fill("")),b=l([]),S=l(!1),d=l(""),N=T(()=>y.value.join("")),le=(t,e)=>{const o=e.target.value.replace(/\D/g,"").slice(-1);y.value[t]=o,o&&t<5&&b.value[t+1]?.focus()},oe=(t,e)=>{e.key==="Backspace"&&!y.value[t]&&t>0&&b.value[t-1]?.focus()},ne=(t,e)=>{if(!t)return;const o=t,n=o.input??o.$el?.querySelector("input");n&&(b.value[e]=n)},re=t=>{const e=t.clipboardData?.getData("text").replace(/\D/g,"").slice(0,6)??"";e&&(t.preventDefault(),e.split("").forEach((o,n)=>{y.value[n]=o}),b.value[Math.min(e.length,5)]?.focus())},ie=async()=>{if(!(S.value||N.value.length<6)){d.value="",S.value=!0;try{(await q.verifyMfaForLogin({code:N.value})).handle({success:e=>{e.login_state===Z.LOGGED_IN&&(window.location.href=K()??G.value)},badRequest:()=>{d.value="Invalid code. Please try again.",y.value=Array(6).fill(""),O(()=>b.value[0]?.focus())},mfaCookieTimeout:()=>{d.value="Session expired. Please log in again.",I.value=!1,p.value="",v.value=!1},accountLocked:()=>{d.value="Account locked. Please contact support."},accountDisabled:()=>{d.value="Account disabled. Please contact support."},unexpectedOrUnhandled:()=>{d.value="Something went wrong. Please try again."}})}catch{d.value="Something went wrong. Please try again."}finally{S.value=!1}}},x=l({}),v=l(!1),ue=l(null),G=T(()=>{try{const e=localStorage.getItem(W);if(e)return e}catch{}const t=B.query.redirect;return typeof t=="string"&&t.startsWith("/")&&!t.startsWith("//")?t:"/"}),K=()=>{try{const t=localStorage.getItem(W);if(t)return localStorage.removeItem(W),t}catch{}return null},V=l(!1),ce=async t=>{try{const e=new URLSearchParams({email:t}),o=await fetch(`${ee.apiBaseUrl}/auth/check-email?${e}`);return o.ok?(await o.json()).exists:!0}catch{return!0}},de=async()=>{if(w.value||f.value)return;c.value="",x.value={},V.value=!1;const t=u.value.trim();if(!t){x.value.email="Enter your email.";return}w.value=!0;try{const[e,o]=await Promise.all([se(t),ce(t)]);if(e.ok&&e.redirectUrl){window.location.href=e.redirectUrl;return}if(!o){V.value=!0;return}v.value=!0,await O()}finally{w.value=!1}},me=async()=>{if(!f.value){c.value="",x.value={},f.value=!0;try{(await q.emailPasswordLogin({email:u.value.trim(),password:p.value})).handle({success:e=>{if(e.login_state===Z.TWO_FACTOR_REQUIRED){I.value=!0,O(()=>b.value[0]?.focus());return}window.location.href=K()??G.value},badRequest:e=>{x.value=e.field_errors||{},c.value=e.user_facing_errors?.email||"Please check your email and password."},invalidCredentials:()=>{c.value="Invalid email or password."},userAccountLocked:()=>{c.value="This account is locked. Please reset your password or contact support."},userAccountDisabled:()=>{c.value="This account is disabled. Please contact support."},passwordLoginDisabled:()=>{c.value="Password login is disabled for this account. Try a different sign-in option."},unexpectedOrUnhandled:()=>{c.value="Something went wrong. Please try again."}})}catch{c.value="Something went wrong. Please try again."}finally{f.value=!1}}},fe=async()=>{v.value?await me():await de()},ve=()=>{v.value=!1,p.value="",c.value="",x.value={}};Re(u,()=>
1{v.value&&(v.value=!1,p.value=""),V.value=!1});const A=l(null),D=l(!1),_=l(""),ge=async()=>{const t=u.value.trim();if(!t){x.value.email="Enter your email above first.";return}if(!D.value){_.value="",D.value=!0;try{(await q.sendForgotPasswordEmail({email:t})).handle({success:o=>{A.value={message:o.message}},badRequest:o=>{_.value=o.user_facing_errors?.email||"Please enter a valid email."},unexpectedOrUnhandled:()=>{_.value="Something went wrong. Please try again."}})}catch{_.value="Something went wrong. Please try again."}finally{D.value=!1}}},pe=()=>{A.value=null,_.value=""},M=l(!1),k=l(null),R=l(""),ye=async()=>{if(M.value)return;if(k.value=null,!u.value.trim()){k.value={ok:!1,message:"Enter your email above first"};return}M.value=!0;const t=await ae(u.value,"login");if(M.value=!1,t.ok){R.value=t.message;return}k.value={ok:!1,message:t.message}},xe=()=>{R.value="",k.value=null},$=l(!1);Le(()=>{$.value=Ee()});const Y=()=>{const t={[Me]:"1"};B.query.redirect&&(t.redirect=B.query.redirect),J.push({path:"/signup",query:t})},we=T(()=>w.value?"Checking…":f.value?"Logging in…":v.value?"Log in":"Continue"),_e=T(()=>f.value||w.value?!0:v.value?!u.value||!p.value:!u.value);return(t,e)=>{const o=Ue,n=Ie,F=Fe,j=Te,Q=ze;return i(),m("div",Ne,[s("div",$e,[a(R)?g("",!0):(i(),m("div",je,[...e[3]||(e[3]=[s("img",{src:Be,alt:"Vector logo",class:"h-7 w-auto"},null,-1),s("h1",{class:"text-xl font-semibold text-white"},"Log in to Vector",-1)])])),a(R)?(i(),P(F,{key:1},{default:C(()=>[s("div",Oe,[r(o,{name:"i-heroicons-envelope",class:"h-10 w-10 text-primary mx-auto"}),s("div",null,[e[4]||(e[4]=s("h1",{class:"text-xl font-semibold"},"Check your email",-1)),s("p",We,h(a(R)),1)]),r(n,{variant:"link",color:"primary",label:"Back to log in",onClick:xe})])]),_:1})):a(I)?(i(),P(F,{key:2},{default:C(()=>[s("div",Ge,[e[5]||(e[5]=s("div",{class:"text-center"},[s("h1",{class:"text-xl font-semibold"},"Verify with 2FA"),s("p",{class:"text-sm text-gray-500 mt-1"}," Enter the 6-digit code generated by your authenticator app: ")],-1)),s("div",{class:"flex justify-center gap-2",onPaste:H(re,["prevent"])},[(i(!0),m(Ve,null,Ae(a(y),(L,E)=>(i(),P(j,{key:E,ref_for:!0,ref:U=>ne(U,E),value:a(y)[E],inputmode:"numeric",maxlength:"1",size:"lg",color:a(d)?"error":"primary",ui:{base:"text-center text-lg font-semibold"},class:"w-11",onInput:U=>le(E,U),onKeydown:U=>oe(E,U)},null,8,["value","color","onInput","onKeydown"]))),128))],32),a(d)?(i(),m("p",Ke,h(a(d)),1)):g("",!0),r(n,{block:"",size:"lg",color:"primary",loading:a(S),disabled:a(N).length<6||a(S),label:"Continue",onClick:ie},null,8,["loading","disabled"]),s("div",Ye,[r(n,{variant:"link",color:"primary",padded:!1,label:"Back to log in",onClick:e[0]||(e[0]=L=>{I.value=!1,y.value=Array(6).fill(""),d.value=""})})])])]),_:1})):a(A)?(i(),P(F,{key:3},{default:C(()=>[s("div",Qe,[r(o,{name:"i-heroicons-envelope",class:"h-10 w-10 text-primary mx-auto"}),s("div",null,[e[6]||(e[6]=s("h1",{class:"text-xl font-semibold"},"Check your email",-1)),s("p",He,h(a(A).message),1)]),r(n,{variant:"link",color:"primary",label:"Back to log in",onClick:pe})])]),_:1})):(i(),P(F,{key:4},{default:C(()=>[s("div",Xe,[r(n,{block:"",size:"lg",color:"neutral",variant:"outline",icon:"i-logos-google-icon",label:"Continue with Google",onClick:a(te)},null,8,["onClick"]),e[11]||(e[11]=s("div",{class:"flex items-center gap-3 text-xs uppercase tracking-wide text-gray-400"},[s("div",{class:"flex-1 h-px bg-gray-200"}),s("span",null,"or"),s("div",{class:"flex-1 h-px bg-gray-200"})],-1)),s("form",{class:"space-y-4",onSubmit:H(fe,["prevent"])},[r(Q,{label:"Email",error:a(x).email,required:""},{default:C(()=>[r(j,{modelValue:a(u),"onUpdate:modelValue":e[1]||(e[1]=L=>X(u)?u.value=L:null),type:"email",autocomplete:"email",placeholder:"[email protected]",disabled:a(f)||a(w),size:"lg",class:"w-full"},null,8,["modelValue","disabled"])]),_:1},8,["error"]),a(v)?(i(),m("div",Ze,[r(Q,{label:"Password",error:a(x).password,required:""},{default:C(()=>[r(j,{ref_key:"passwordInputRef",ref:ue,modelValue:a(p),"onUpdate:modelValue":e[2]||(e[2]=L=>X(p)?p.value=L:null),type:"password",autocomplete:"current-password",placeholder:"••••••••",disabled:a(f),size:"lg",class:"w-full"},null,8,["modelValue","disabled"])]),_:1},8,["error"]),s("div",Je,[s("span",null,[e[7]||(e[7]=z(" Logging in as ",-1)),s("span",et,h(a(u)),1),e[8]||(e[8]=z(". ",-1)),r(n,{variant:"link",color:"primary",size:"xs",class:"p-0",padded:!1,label:"Use a different email",onClick:ve})]),r(n,{variant:"link",color:"primary",size:"xs",padded:!1,loading:a(D),label:"Forgot password?",onClick:ge},null,8,["loading"])]),a(_)?(i(),m("p",tt,h(a(_)),1)):g("",!0)])):g("",!0),a(c)?(i(),m("p",at,h(a(c)),1)):g("",!0),a(V)?(i(),m("div",st,[r(o,{name:"i-heroicons-exclamation-triangle",class:"h-4 w-4 mt-0.5 shrink-0"}),s("span",null,[e[9]||(e[9]=z(" No account found for this email ",-1)),a($)?(i(),P(n,{key:0,variant:"link",color:"primary",size:"xs",padded:!1,label:"Sign up instead",class:"p-0 font-semibold",onClick:Y})):g("",!0)])])):g("",!0),r(n,{type:"submit",block:"",size:"lg",color:"primary",loading:a(f)||a(w),disabled:a(_e),label:a(we)},null,8,["loading","disabled","label"]),r(n,{block:"",size:"lg",color:"neutral",variant:"outline",icon:"i-heroicons-envelope",loading:a(M),label:"Sign in with Magic Link",onClick:ye},null,8,["loading"]),a(k)?(i(),m("p",{key:3,class:De(["text-xs text-center",a(k).ok?"text-green-700":"text-red-600"])},h(a(k).message),3)):g("",!0)],32),a($)?(i(),m("div",lt,[e[10]||(e[10]=z(" New to Vector? ",-1)),r(n,{variant:"link",color:"primary",class:"text-primary-600 font-semibold p-0",padded:!1,label:"Create an account",onClick:Y})])):g("",!0)])]),_:1}))])])}}});
1export{ft as default};
2//# sourceMappingURL=vheuUgaE.js.map

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.