PageSourceSearch

https://xterns.ai/assets/UnifiedLogin-YUrSOTuv.js

js xterns.ai collected 2026-10-05 13:23:17 UTC 9,362 bytes, 1 lines download raw bytes

1import{f as F,r as p,j as e,B as i,g as n,u as z,h as v,i as b,k as N,l as C,m as k,I as j,L as S,s as L}from"./index-DLd_kDlx.js";import{L as y}from"./label-D4-ENrYn.js";import{L as P}from"./Layout-B4HKaXoo.js";import{L as x}from"./loader-circle-D2miE2xB.js";import{A as I}from"./arrow-left-BXtn7MCa.js";import{M as B}from"./mail-BVn2o8AP.js";const M=({userType:d,isSignUp:g=!1})=>{const{loginWithGoogle:o,loginWithGitHub:l,loginWithLinkedIn:f}=F(),[r,a]=p.useState(null);if(d==="enterprise"||d==="corporate")return null;const m=async(h,u)=>{a(h);try{await u(d)}catch(t){console.error(`${h} auth error:`,t),n.error(`${h} authentication failed`,{description:t.message||"Please try again."})}finally{a(null)}},c=g?"Sign up":"Continue";return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t border-gray-200"})}),e.jsx("div",{className:"relative flex justify-center text-sm",children:e.jsxs("span",{className:"px-2 bg-white text-gray-500",children:["Or ",c.toLowerCase()," with"]})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(i,{type:"button",variant:"outline",onClick:()=>m("google",o),disabled:r!==null,className:"w-full h-11 flex items-center justify-center gap-3 border-gray-200 hover:bg-gray-50",children:[r==="google"?e.jsx(x,{className:"h-4 w-4 animate-spin"}):e.jsxs("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",children:[e.jsx("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),e.jsx("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),e.jsx("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),e.jsx("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]}),e.jsxs("span",{className:"text-gray-700 font-medium",children:[c," with Google"]})]}),e.jsxs(i,{type:"button",variant:"outline",onClick:()=>m("github",l),disabled:r!==null,className:"w-full h-11 flex items-center justify-center gap-3 border-gray-200 hover:bg-gray-50",children:[r==="github"?e.jsx(x,{className:"h-4 w-4 animate-spin"}):e.jsx("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{d:"M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"})}),e.jsxs("span",{className:"text-gray-700 font-medium",children:[c," with GitHub"]})]}),e.jsxs(i,{type:"button",variant:"outline",onClick:()=>m("linkedin",f),disabled:r!==null,className:"w-full h-11 flex items-center justify-center gap-3 border-gray-200 hover:bg-gray-50",children:[r==="linkedin"?e.jsx(x,{className:"h-4 w-4 animate-spin"}):e.jsx("svg",{className:"h-5 w-5",fill:"#0A66C2",viewBox:"0 0 24 24",children:e.jsx("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"})}),e.jsxs("span",{className:"text-gray-700 font-medium",children:[c," with LinkedIn"]})]})]})]})},W=()=>{const d=z(),{login:g}
1=F(),[o,l]=p.useState(!1),[f,r]=p.useState(!1),[a,m]=p.useState({email:"",password:""}),c=async t=>{t.preventDefault(),l(!0);try{sessionStorage.removeItem("auth_session_processed"),sessionStorage.removeItem("dashboard_modal_shown"),sessionStorage.removeItem("prevent_landing_redirect");const s=await g(a.email,a.password);n.success("Welcome back!",{description:s.requiresDashboardSelection?"Successfully signed in! Choose your dashboard to continue.":"Successfully signed in! Redirecting..."}),!s.requiresDashboardSelection&&s.dashboardPath&&d(s.dashboardPath,{replace:!0})}catch(s){console.error("Login error:",s),n.error("Sign in failed",{description:s.message||"Please check your credentials and try again."})}finally{l(!1)}},h=async t=>{if(t.preventDefault(),!a.email){n.error("Please enter your email address");return}l(!0);try{const{data:s,error:E}=await L.functions.invoke("user-exists-by-email",{body:{email:a.email}});if(E)throw new Error("Failed to verify email address");if(!s.exists){n.error("No account found with this email",{description:"Please check your email address or sign up for a new account."}),l(!1);return}const{error:w}=await L.auth.resetPasswordForEmail(a.email,{redirectTo:`${window.location.origin}/reset-password`});if(w)throw w;n.success("Password reset link sent!",{description:"Please check your email for the reset link (valid for 30 minutes)."}),r(!1)}catch(s){console.error("Password reset error:",s),n.error("Failed to send reset link",{description:s.message||"Please try again."})}finally{l(!1)}},u=t=>{m(s=>({...s,[t.target.name]:t.target.value}))};return f?e.jsx(P,{children:e.jsx("div",{className:"container max-w-md py-16 md:py-24",children:e.jsxs(v,{className:"shadow-lg border-0 bg-card/95 backdrop-blur-sm",children:[e.jsxs(b,{className:"text-center pb-6",children:[e.jsxs("div",{className:"flex items-center justify-center mb-4",children:[e.jsxs(i,{variant:"ghost",size:"sm",onClick:()=>r(!1),className:"absolute left-4 top-4",children:[e.jsx(I,{className:"h-4 w-4 mr-2"}),"Back"]}),e.jsx("div",{className:"w-12 h-12 bg-primary/10 rounded-full flex items-center justify-center",children:e.jsx(B,{className:"h-6 w-6 text-primary"})})]}),e.jsx(N,{className:"text-2xl font-bold",children:"Reset Password"}),e.jsx(C,{children:"Enter your email address and we'll send you a link to reset your password"})]}),e.jsx(k,{children:e.jsxs("form",{onSubmit:h,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(y,{htmlFor:"reset-email",className:"text-sm font-medium",children:"Email"}),e.jsx(j,{id:"reset-email",name:"email",type:"email",placeholder:"Enter your email address",value:a.email,onChange:u,required:!0,className:"h-11"})]}),e.jsx(i,{type:"submit",className:"w-full h-11",disabled:o,children:o?e.jsxs(e.Fragment,{children:[e.jsx(x,{className:"mr-2 h-4 w-4 animate-spin"}),"Sending..."]}):"Send Reset Link"})]})})]})})}):e.jsx(P,{children:e.jsxs("div",{className:"container max-w-xl py-16 md:py-24",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Welcome Back"}),e.jsx("p",{className:"text-muted-foreground",children:"Sign in to access your dashboard"})]}),e.jsxs(v,{className:"shadow-lg border-0 bg-card/95 backdrop-blur-sm",children:[e.jsxs(b,{className:"text-center pb-6",children:[e.jsx(N,{className:"text-2xl font-bold",children:"Sign In"}),e.jsx(C,{children:"Enter your credentials to continue"})]}),e.jsxs(k,{className:"space-y-6",children:[e.jsxs("form",{onSubmit:c,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(y,{htmlFor:"email",className:"text-sm font-medium",children:"Email"}),e.jsx(j,{id:"email",name:"email",type:"email",placeholder:"Enter your email address",value:a.email,onChange:u,required:!0,className:"h-11"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(y,{htmlFor:"password",className:"text-sm font-medium",children:"Password"}),e.jsx(i,{type:"button",variant:"link",className:"text-xs text-primary p-0 h-auto",onClick:()=>r(!0),children:"Forgot password?"})]}),e.jsx(j,{id:"password",name:"password",type:"password",placeholder:"Enter your password",value:a.password,onChange:u,required:!0,className:"h-11"})]}),e.jsx(i,{type:"submit",className:"w-full h-11 font-medium",disabled:o,children:o?e.jsxs(e.Fragment,{children:[e.jsx(x,{className:"mr-2 h-4 w-4 animate-spin"}),"Signing in..."]}):"Sign In"})]}),e.jsx(M,{userType:"xtern"}),e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Don't have an account?"}),e.jsxs("div",{className:"flex gap-2 justify-center flex-wrap",children:[e.jsx(S,{to:"/signup",children:e.jsx(i,{variant:"outline",size:"sm",children:"Sign up as Xtern"})}),e.jsx(S,{to:"/signup/tech-lead",children:e.jsx(i,{variant:"outline",size:"sm",children:"Sign up as Tech Lead"})})]})]})]})]})]})})};export{W 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.