1import{d as F,C as z,D as B,r as i,c as G,I as P,J as Q,G as S,P as $,w as b,f as D,K as I,q as O,e as U,j as t,s as n,L as K,M as g,N as L,Q as R,t as k,A as j,B as q,O as V,o as H,_ as J}from"./index-acdb360f.js";const x=c=>(j("data-v-2d980f06"),c=c(),q(),c),W={class:"onboarding"},Y=x(()=>t("div",{class:"onboarding-heading"},"Login to see contributions.",-1)),X={class:"onboarding-form"},Z=x(()=>t("div",{class:"onboarding-form__divider"},[t("div",{class:"onboarding-form__divider-line"}),V(" OR "),t("div",{class:"onboarding-form__divider-line"})],-1)),ee={class:"onboarding-form__fields"},ae={class:"onboarding-form__fields-useFile"},oe={class:"onboarding-form__ctas"},te={name:"LogIn"},se=F({...te,setup(c){z({title:"Login"});const m=B("auth"),A=i(null),s=i(""),l=i(""),p=()=>s.value.length>0&&s.value.match(/^[^\s@]+@[^\s@]+\.[^\s@]+$/),_=()=>l.value.length>=8,T=G(()=>p()&&_()),C=P(),E=Q(),N=S(),r=i(!1),v=$(),f=i(),u=i();b(s,()=>{p()?f.value=void 0:f.value=s.value.length?"You have to provide a valid email":"This field cannot be empty"}),b(l,()=>{_()?u.value=void 0:u.value="This field must contain at least 8 characters"});async function h(){if(!(!T.value||r.value)){r.value=!0;try{const a=await m.login(s.value,l.value),e=await a.user.getIdToken();await I(e),await y(a)}catch(a){console.error(a),a.code==="auth/invalid-login-credentials"?u.value="Invalid email or password":u.value="An error occurred. Try again"}finally{r.value=!1}}}D(async()=>{r.value=!0;const a=await m.checkAuth();if(a){const e=await a.user.getIdToken();await I(e),await y(a)}else r.value=!1});async function y(a){const[e,d]=await Promise.all([C(void 0),E(void 0)]);if(e.fullName&&!e.username)return v.redirect("/create/username");if(e.fullName&&e.username&&(!e.hasFigmaContent||!d.length))return v.redirect("/connect-figma");if(e.fullName&&e.username&&d.length){window.location.href=`/${e.username}`;return}const o=a.user.displayName,M=a.user.providerData[0].providerId==="password"?"EMAIL":"GOOGLE",w={fullName:o,authenticationType:M};a.user.photoURL&&!e.avatar&&(w.avatar=a.user.photoURL),await N.mutateAsync({body:w}),v.redirect("/create/username")}return(a,e)=>{const d=O("router-link");return H(),U("div",W,[Y,t("div",X,[n(g,{btnTxt:"Login with Google",onClick:e[0]||(e[0]=o=>K(m).googleAuth()),icon:"google-logo",type:"secondary",size:"md",animate:""}),Z,t("div",ee,[n(L,{ref_key:"emailInput",ref:A,"err-msg":f.value,placeholder:"Email",type:"email",modelValue:s.value,"onUpdate:modelValue":e[1]||(e[1]=o=>s.value=o)},null,8,["err-msg","modelValue"]),n(L,{placeholder:"Password","err-msg":u.value,type:"password",modelValue:l.value,"onUpdate:modelValue":e[2]||(e[2]=o=>l.value=o),onKeyup:e[3]||(e[3]=R(o=>h(),["enter"]))},null,8,["err-msg","modelValue"]),t("div",ae,[n(d,{to:"/forgot-password"},{default:k(()=>[V(" Forgot Password ")]),_:1})])]),t("div",oe,[n(g,{btnTxt:"Login",size:"md",onClick:e[4]||(e[4]=o=>h()),loading:r.value,type:"primary"},null,8,["loading"]),n(d,{to:"/create/account"},{default:k(()=>[n(g,{btnTxt:"Donât have an account? Sign up",size:"md",type:"tertiary"})]),_:1})])])])}}});const re=J(se,[["__scopeId","data-v-2d980f06"],["__file","/app/src/views/auth/LogIn.vue"]]);export{re 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.