PageSourceSearch

https://help.speechelo.com/build/assets/Login-DuCIHYYl.js

js speechelo.com collected 2026-09-25 20:13:54 UTC 10,714 bytes, 1 lines download raw bytes

1import{r as n,u as Q,i as W,j as e,L as Y}from"./vendor-react-DgB3iddG.js";import{u as K,t as B,R as X,L as Z,a as ee}from"./index-BjBy4T9C.js";import{u as te}from"./usePageTitle-DrV3LWkF.js";import{B as M}from"./Button-BttGaDhY.js";import{I as _}from"./Input-BsRlGHyA.js";import{m as se}from"./vendor-framer-icxhH28V.js";import{S as ae}from"./shield-check-DTFahSIP.js";import"./vendor-realtime-BWTNjo9H.js";import"./vendor-mui-dates-KAGm-C0e.js";import"./vendor-radix-Cc5wg9nu.js";function pe(){te("Login");const[l,C]=n.useState(!1),[p,D]=n.useState(""),[y,U]=n.useState(""),[E,w]=n.useState(!1),[A,c]=n.useState(null),[L,f]=n.useState(null),[V,j]=n.useState(!1),[N,P]=n.useState(null),[g,k]=n.useState(null),[q,b]=n.useState(""),[I,R]=n.useState(!1),{signIn:z,signUp:T,user:S}=K(),o=Q(),v=W();n.useEffect(()=>{S&&o({pathname:"/dashboard",search:v.search},{replace:!0})},[S,o,v.search]),n.useEffect(()=>{(async()=>{var a;try{const u=await(await fetch("https://app.pagedock.ai/api/settings/registration")).json();P(((a=u==null?void 0:u.data)==null?void 0:a.allow_free_signup)??!1)}catch(s){console.error("Failed to fetch registration settings:",s),P(!1)}})()},[]),n.useEffect(()=>{const t=new URLSearchParams(v.search);if(t.get("verified")==="true"&&(f("Email verified successfully! You can now log in."),B.success("Email verified successfully!",{id:"verify-success"}),window.history.replaceState({},document.title,window.location.pathname)),!S&&t.get("verified")==="false"&&t.get("error")){const a=t.get("error");let s="Email verification failed.";a==="invalid_link"?s="This verification link is invalid or has expired. Please request a new one.":a==="invalid_user"&&(s="Invalid verification link. User not found."),c(s),B.error(s,{id:"verify-error"}),window.history.replaceState({},document.title,window.location.pathname)}t.get("mode")==="signup"&&N===!0&&(C(!0),window.history.replaceState({},document.title,window.location.pathname)),t.get("signup_disabled")==="true"&&(c(e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Free signups are currently disabled. Please purchase a license to access PageDock."}),e.jsx("a",{href:"https://pagedock.ai?ref=insoftsignup",target:"_blank",rel:"noopener noreferrer",className:"inline-block px-4 py-2 bg-[#FF4F00] hover:bg-[#FF4F00]/90 text-white rounded-lg text-sm font-medium transition-colors",children:"Purchase License"})]})),window.history.replaceState({},document.title,window.location.pathname))},[v,N]);const H=async t=>{var a,s,u,F,x;t.preventDefault(),w(!0),c(null),f(null),j(!1);try{if(l){const{error:i,data:d}=await T({email:p,password:y});if(i)throw i;d.user&&!d.session?f("Check your email for the confirmation link."):o("/onboarding")}else{const i=g?{captcha_id:g.captcha_id,captcha_answer:q}:null,{error:d,data:h}=await z({email:p,password:y,captcha:i});if(d)throw d;k(null),b("");const r=((a=h==null?void 0:h.user)==null?void 0:a.permissions)||[];!r.length||r.includes("*")||r.includes("view_dashboard")?o("/dashboard"):r.includes("view_inbox")?o("/dashboard/inbox"):r.includes("view_accounts")?o("/dashboard/accounts"):r.includes("view_analytics")?o("/dashboard/analytics"):r.includes("view_moderation")?o("/dashboard/moderation"):r.includes("manage_team")?o("/dashboard/team"):r.includes("manage_billing")?o("/dashboard/billing"):o("/dashboard")}}catch(i){c(i.message),((s=i.data)!=null&&s.requires_verification||(u=i.message)!=null&&u.includes("verify"))&&j(!0),(F=i.data)!=null&&F.requires_captcha&&((x=i.data)!=null&&x.captcha)&&(k(i.data.captcha),b(""))}finally{w(!1)}},O=async()=>{var t;R(!0);try{const a=await fetch("https://app.pagedock.ai/api/auth/captcha/login",{headers:{Accept:"application/json"}}),s=await a.json();a.ok&&((t=s==null?void 0:s.data)!=null&&t.captcha_id)&&(k({captcha_id:s.data.captcha_id,question:s.data.question}),b(""))}catch{}finally{R(!1)}},G=async()=>{var t,a;if(p){w(!0);try{await ee.post("/resend-verification",{email:p}),f("Verification email sent! Please check your inbox."),j(!1),c(null)}catch(s){c(((a=(t=s.response)==null?void 0:t.data)==null?void 0:a.message)||"Failed to resend verification email.")}finally{w(!1)}}},J=t=>{localStorage.setItem("auth_action","login"),sessionStorage.setItem("auth_action","login");const a=600,s=700,u=window.screen.width/2-a/2,F=window.screen.height/2-s/2,x=`https://app.pagedock.ai/api/social/auth/${t}`,i=window.open(x,`PageDock ${t} Login`,`width=${a},height=${s},left=${u},top=${F}`);
1if(!i||i.closed||typeof i.closed>"u"){window.location.href=x;return}const d=h=>{if(h.origin===window.location.origin){if(h.data.type==="login-success"){const{token:r,user:m}=h.data;r&&(localStorage.setItem("auth_token",r),localStorage.setItem("auth_user",JSON.stringify(m)),localStorage.setItem("page_dock_is_admin",JSON.stringify(m.is_admin||!1)),setTimeout(()=>{(m==null?void 0:m.has_password)===!1?window.location.replace("/set-password"):window.location.replace("/dashboard")},100)),window.removeEventListener("message",d)}if(h.data.type==="login-error"){const{message:r,requires_license:m,purchase_url:$}=h.data;c(m&&$?e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:r}),e.jsx("a",{href:$,target:"_blank",rel:"noopener noreferrer",className:"inline-block px-4 py-2 bg-[#FF4F00] hover:bg-[#FF4F00]/90 text-white rounded-lg text-sm font-medium transition-colors",children:"Purchase License"})]}):r),window.removeEventListener("message",d)}}};window.addEventListener("message",d)};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-[#F8FAFC] p-4",children:e.jsxs(se.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4},className:"w-full max-w-[440px] relative z-10 px-6",children:[e.jsxs("div",{className:"mb-10 text-center",children:[e.jsx("img",{src:"/assets/images/logo.png",alt:"PageDock",className:"h-14 mx-auto mb-6"}),e.jsx("h1",{className:"text-3xl font-bold tracking-tight text-[#0F172A] mb-2",children:l?"Create your account":"Welcome back"}),e.jsx("p",{className:"text-[#64748B] text-base",children:l?"Sign up to get started with PageDock":"Sign in to continue to PageDock"})]}),e.jsxs("div",{className:"bg-white border border-[#E2E8F0] rounded-2xl p-8 shadow-xl",children:[e.jsx("div",{className:"space-y-3 mb-6",children:e.jsxs(M,{variant:"outline",className:"w-full bg-white hover:bg-[#F8FAFC] text-[#0F172A] border-[#E2E8F0] h-12 font-semibold",onClick:()=>J("google"),children:[e.jsxs("svg",{className:"mr-2 h-5 w-5",viewBox:"0 0 24 24",children:[e.jsx("path",{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",fill:"#4285F4"}),e.jsx("path",{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",fill:"#34A853"}),e.jsx("path",{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",fill:"#FBBC05"}),e.jsx("path",{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",fill:"#EA4335"})]}),"Continue with Google"]})}),e.jsxs("div",{className:"relative my-6",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t border-[#E2E8F0]"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-white px-3 text-[#94A3B8] font-semibold tracking-wider",children:"Or continue with email"})})]}),e.jsxs("form",{onSubmit:H,className:"space-y-4",children:[e.jsx("div",{className:"space-y-2",children:e.jsx(_,{type:"email",placeholder:"[email protected]",value:p,onChange:t=>D(t.target.value),className:"h-12 bg-[#F8FAFC] border-[#E2E8F0] focu
1s:bg-white focus:border-[#FF4F00] text-[#0F172A]",required:!0})}),e.jsx("div",{className:"space-y-2",children:e.jsx(_,{type:"password",placeholder:"Password",value:y,onChange:t=>U(t.target.value),className:"h-12 bg-[#F8FAFC] border-[#E2E8F0] focus:bg-white focus:border-[#FF4F00] text-[#0F172A]",required:!0})}),!l&&e.jsx("div",{className:"flex justify-end",children:e.jsx(Y,{to:"/forgot-password",className:"text-sm font-medium text-[#FF4F00] hover:underline",children:"Forgot password?"})}),A&&e.jsxs("div",{className:"text-red-600 text-sm text-center bg-red-50 p-3 rounded-lg border border-red-100",children:[A,V&&e.jsx("button",{type:"button",onClick:G,className:"block w-full mt-2 text-[#FF4F00] hover:underline font-medium",children:"Resend Verification Email"})]}),L&&e.jsx("div",{className:"text-emerald-600 text-sm text-center bg-emerald-50 p-3 rounded-lg border border-emerald-100",children:L}),!l&&g&&e.jsxs("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-amber-800",children:[e.jsx(ae,{className:"h-4 w-4","aria-hidden":"true"}),e.jsx("span",{children:"Quick security check"})]}),e.jsx("p",{className:"text-xs text-amber-800",children:"A few sign-in attempts didn't work. Please solve this so we know you're not a bot."}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"flex-shrink-0 inline-flex items-center justify-center min-w-[88px] h-10 px-3 rounded-md bg-white border border-amber-200 text-[#0F172A] font-mono font-semibold text-sm select-none","aria-label":`Solve: ${g.question}`,children:g.question}),e.jsx(_,{type:"text",inputMode:"numeric",autoComplete:"off",placeholder:"Answer",value:q,onChange:t=>b(t.target.value),className:"h-10 bg-white border-amber-200 focus:border-amber-400 text-[#0F172A]",required:!0}),e.jsx("button",{type:"button",onClick:O,disabled:I,className:"flex-shrink-0 inline-flex items-center justify-center h-10 w-10 rounded-md border border-amber-200 bg-white text-amber-700 hover:text-amber-900 hover:bg-amber-100 transition-colors disabled:opacity-50",title:"Get a new question","aria-label":"Refresh security check",children:e.jsx(X,{className:`h-4 w-4 ${I?"animate-spin":""}`,"aria-hidden":"true"})})]})]}),e.jsx(M,{className:"w-full h-12 font-semibold text-base shadow-md hover:shadow-lg transition-all active:translate-y-[1px] bg-[#FF4F00] hover:bg-[#FF4F00]/90 text-white",disabled:E,children:E?e.jsx(Z,{className:"mr-2 h-5 w-5 animate-spin"}):l?"Create Account":"Sign In"})]}),(l||N===!0)&&e.jsxs("p",{className:"text-center text-[#64748B] text-sm mt-6",children:[l?"Already have an account?":"Don't have an account?"," ",e.jsx("button",{onClick:()=>{C(!l),c(null),f(null)},className:"text-[#FF4F00] hover:underline transition-all font-semibold",children:l?"Sign In":"Sign Up"})]})]})]})})}export{pe 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.