PageSourceSearch

https://www.amtaxhub.com/assets/Login-S1qm_da_.js

js amtaxhub.com collected 2026-10-02 01:23:21 UTC 17,902 bytes, 1 lines download raw bytes

1import{i as e}from"./rolldown-runtime-B1_YRrcp.js";import{M as t,Q as r,et as n,fn as a,ln as s,m as i,tt as o,ut as l,x as d}from"./vendor-icons-DbMHrEps.js";import{t as c}from"./vendor-react-BqguG9ET.js";import{d as p,g as m}from"./index-ALf5LHJb.js";import{n as g,r as u,t as h}from"./AuthPortalServices-gkur8FaG.js";var x=e(a(),1),f=c();function y({setActivePage:e}){const{login:a,error:c,setError:y,loginWithGoogle:w}=m(),b=p(),[j,S]=(0,x.useState)({email:"",password:""}),[C,P]=(0,x.useState)(!1),[N,T]=(0,x.useState)("undefined"!=typeof window&&window.innerWidth<1024),k=()=>{if("undefined"==typeof window)return!1;const e=new URLSearchParams(window.location.search).get("return")||"";return!("/marketplace/"!==e&&!e.startsWith("/marketplace/#")||(window.location.assign(e),0))};(0,x.useEffect)(()=>{window.scrollTo({top:0,behavior:"instant"});const e=()=>T(window.innerWidth<1024);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const z=(0,x.useRef)(null);(0,x.useEffect)(()=>{let e=!1;if(b?.google_client_id)return u().then(()=>{if(!e&&"undefined"!=typeof window&&window.google&&window.google.accounts){const e=b?.google_client_id||"";if(!e)return;window.google.accounts.id.initialize({client_id:e,callback:A}),z.current&&window.google.accounts.id.renderButton(z.current,{theme:"outline",size:"large",width:N?320:370,text:"continue_with",shape:"rectangular"})}}).catch(()=>{}),()=>{e=!0}},[b,N]);const A=async t=>{P(!0),y(null);const r=await w(t.credential);if(P(!1),r.success){if(k())return;"admin"===r.role?e("admin-dashboard"):"consultant"===r.role?e("consultant-dashboard"):"branch"===r.role?e("branch-dashboard"):"marketing_agent"===r.role?e("marketing-agent-dashboard"):e("client-dashboard"),window.scrollTo({top:0,behavior:"smooth"})}},[B,R]=(0,x.useState)(!1),[I,L]=(0,x.useState)(1),[O,D]=(0,x.useState)(""),[E,F]=(0,x.useState)(""),[W,_]=(0,x.useState)({password:"",confirmPassword:""}),[H,q]=(0,x.useState)(60),J=(0,x.useRef)(null),[M,V]=(0,x.useState)(!1),[Y,G]=(0,x.useState)(""),[U,Q]=(0,x.useState)(""),[X,K]=(0,x.useState)(60),[Z,$]=(0,x.useState)(!1),ee=(0,x.useRef)(null);(0,x.useEffect)(()=>(M&&(K(60),ee.current=setInterval(()=>{K(e=>e<=1?(clearInterval(ee.current),0):e-1)},1e3)),()=>clearInterval(ee.current)),[M]),(0,x.useEffect)(()=>()=>{J.current&&clearInterval(J.current)},[]);const te=e=>{S({...j,[e.target.name]:e.target.value})};return(0,f.jsxs)("div",{className:"auth-portal-page animate-fade-in",children:[(0,f.jsxs)("div",{className:"auth-portal-layout",children:[(0,f.jsx)("div",{className:"auth-portal-banner-column",children:(0,f.jsx)(g,{page:"login"})}),(0,f.jsx)("div",{className:"auth-portal-form-column",children:(0,f.jsxs)("div",{className:"auth-portal-card glass-card",style:{...v.loginCard,padding:N?"24px 16px":"36px",width:"100%",maxWidth:"100%",borderRadius:"24px",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.15)"},children:[(0,f.jsxs)("div",{style:v.header,children:[(0,f.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"10px",marginBottom:"20px"},children:[(0,f.jsx)("img",{src:"/logo-icon.webp",alt:"AM Tax Hub Icon",width:"36",height:"36",className:"logo-icon-36",style:{width:"36px",height:"36px",aspectRatio:"1 / 1"}}),(0,f.jsxs)("div",{style:{display:"flex",flexDirection:"column",textAlign:"left"},children:[(0,f.jsx)("span",{className:"brand-title",style:{fontFamily:"var(--font-heading)",fontSize:"1.15rem",fontWeight:"800",color:"var(--primary)",letterSpacing:"0.3px",lineHeight:"1.2"},children:"AM TAX & CORPORATE HUB"}),(0,f.jsx)("span",{className:"brand-subtitle",style:{fontFamily:"var(--font-body)",fontSize:"0.65rem",fontWeight:"600",color:"var(--accent-teal)",textTransform:"uppercase",letterSpacing:"0.5px",lineHeight:"1"},children:"Smart Solutions for Modern Taxpayers"})]})]}),(0,f.jsx)("h1",{style:{...v.title,fontSize:N?"1.4rem":"1.6rem"},children:"Secure Portal Gateway"}),(0,f.jsx)("p",{style:v.subtitle,children:"Enter credentials to access your tax filing records."})]}),c&&(0,f.jsxs)("div",{style:v.errorBanner,children:[(0,f.jsx)(d,{size:18}),(0,f.jsx)("span",{children:String(c).replace(/^Filer\s+/i,"Email ")})]}),B?(0,f.jsxs)("div",{className:"animate-fade-in",children:[1===I&&(0,f.jsxs)("form",{onSubmit:async e=>{if(e.preventDefault(),O){P(!0),y(null);try{const e=await(await fetch("/api/auth/forgot-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:O})})).json();P(!1),e.success?(L(2),F(""),q(60),J.current&&clearInterval(J.current),J.current=setInterval(()=>{q(e=>e<=1?(clearInterval(J.current),0):e-1)},1e3)):y(e.message)}catch(t){P(!1),y("Connection failed. Please try again.")}}else y("Please enter your registered email address.")},children:[(0,f.jsx)("p",{style:{color:"var(--text-muted)",fontSize:"0.85rem",marginBottom:"20px",textAlign:"center",lineHeight:"1.5"},children:"Enter your registered email address to receive a secure 6-digit OTP to verify your identity."}),(0,f.jsxs)("div",{className:"form-group",children:[(0,f.jsxs)("label",{htmlFor:"recovery-email",className:"form-label",style:v.label,children:[(0,f.jsx)(r,{size:16,style:{color:"var(--accent-gold)"}})," Registered Email"]}),(0,f.jsx)("input",{id:"recovery-email",type:"email",value:O,onChange:e=>D(e.target.value),className:"form-control",placeholder:"e.g. [email protected]",required:!0})]}),(0,f.jsx)("button",{type:"submit",className:"btn btn-gold",style:{width:"100%",marginTop:"20px"},disabled:C,children:C?"Sending Code...":"Send Reset OTP"}),(0,f.jsx)("div",{style:v.footerLink,children:(0,f.jsxs)("a",{href:"#login",onClick:e=>{e.preventDefault(),R(!1),y(null)},style:v.signupLink,children:[(0,f.jsx)(s,{size:14,style:{marginRight:"6px",display:"inline-block",verticalAlign:"middle"}})," Return to Login"]})})]}),2===I&&(0,f.jsxs)("form",{onSubmit:async e=>{if(e.preventDefault(),6===E.length){P(!0),y(null);try{const e=await(await fetch("/api/auth/verify-reset-otp",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:O,otp:E})})).json();P(!1),e.success?(L(3),_({password:"",confirmPassword:""})):y(e.message)}catch(t){P(!1),y("Verification failed. Please try again.")}}else y("Please enter the 6-digit verification code.")},children:[(0,f.jsxs)("p",{style:{color:"var(--text-muted)",fontSize:"0.85rem",marginBottom:"20px",textAlign:"center",lineHeight:"1.5"},children:["A 6-digit password reset OTP has been sent to ",(0,f.jsx)("strong",{children:O}),". Enter it below to proceed."]}),(0,f.jsxs)("div",{className:"form-group",children:[(0,f.jsx)("label",{htmlFor:"recovery-otp",className:"form-label",style:{textAlign:"center"},children:"6-Digit OTP Code"}),(0,f.jsx)("input",{id:"recovery-otp",type:"text",maxLength:"6",value:E,onChange:e=>F(e.target.value.replace(/\D/g,"")),className:"form-control",placeholder:"------",style:{textAlign:"center",fontSize:"1.6rem",fontWeight:"800",letterSpacing:"6px",height:"54px"},required:!0})]}),(0,f.jsx)("button",{type:"submit",className:"btn btn-gold",style:{width:"100%",marginTop:"10px"},disabled:C,children:C?"Verifying Code...":"Verify Security Code"}),(0,f.jsxs)("div",{style:v.resendSection,children:[(0,f.jsx)("p",{style:{color:"var(--text-muted)",fontSize:"0.85rem",marginBottom:"10px",textAlign:"center"},children:"Didn't receive the code?"}),H>0?(0,f.jsxs)("div",{style:v.cooldownBadge,children:[(0,f.jsx)(i,{size:14}),(0,f.jsxs)("span",{children:["Resend available in ",(0,f.jsxs)("strong",{children:[H,"s"]})]})]}):(0,f.jsxs)("button",{type:"button",onClick:async()=>
1{if(!(H>0)){P(!0),y(null);try{const e=await(await fetch("/api/auth/forgot-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:O})})).json();P(!1),e.success?(F(""),q(60),J.current&&clearInterval(J.current),J.current=setInterval(()=>{q(e=>e<=1?(clearInterval(J.current),0):e-1)},1e3)):y(e.message)}catch(e){P(!1),y("Failed to resend code. Please try again.")}}},disabled:C,style:v.resendBtn,children:[(0,f.jsx)(t,{size:14}),"Resend OTP Code"]})]}),(0,f.jsx)("div",{style:v.footerLink,children:(0,f.jsxs)("a",{href:"#back",onClick:e=>{e.preventDefault(),L(1),y(null)},style:v.signupLink,children:[(0,f.jsx)(s,{size:14,style:{marginRight:"6px",display:"inline-block",verticalAlign:"middle"}})," Back to Step 1"]})})]}),3===I&&(0,f.jsxs)("form",{onSubmit:async e=>{if(e.preventDefault(),W.password===W.confirmPassword)if(W.password.length<10)y("Password must be at least 10 characters.");else{P(!0),y(null);try{const e=await(await fetch("/api/auth/reset-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:O,otp:E,password:W.password,confirm_password:W.confirmPassword})})).json();P(!1),e.success?(alert("Your password has been successfully reset! You can now log into your account with your new password."),R(!1),L(1),D(""),F(""),_({password:"",confirmPassword:""}),y(null)):y(e.message)}catch(t){P(!1),y("Failed to reset password. Please try again.")}}else y("Passwords do not match. Please verify your entries.")},children:[(0,f.jsx)("p",{style:{color:"var(--text-muted)",fontSize:"0.85rem",marginBottom:"20px",textAlign:"center",lineHeight:"1.5"},children:"Create a secure, strong new password for your account. Both entries must match."}),(0,f.jsxs)("div",{className:"form-group",children:[(0,f.jsxs)("label",{htmlFor:"new-password",className:"form-label",style:v.label,children:[(0,f.jsx)(o,{size:16,style:{color:"var(--accent-gold)"}})," New Password"]}),(0,f.jsx)("input",{id:"new-password",type:"password",value:W.password,onChange:e=>_({...W,password:e.target.value}),className:"form-control",placeholder:"Minimum 10 characters",minLength:10,required:!0})]}),(0,f.jsxs)("div",{className:"form-group",style:{marginBottom:"25px"},children:[(0,f.jsxs)("label",{htmlFor:"confirm-new-password",className:"form-label",style:v.label,children:[(0,f.jsx)(o,{size:16,style:{color:"var(--accent-gold)"}})," Confirm New Password"]}),(0,f.jsx)("input",{id:"confirm-new-password",type:"password",value:W.confirmPassword,onChange:e=>_({...W,confirmPassword:e.target.value}),className:"form-control",placeholder:"Re-enter password",required:!0})]}),(0,f.jsx)("button",{type:"submit",className:"btn btn-gold",style:{width:"100%"},disabled:C,children:C?"Resetting Password...":"Reset & Update Password"}),(0,f.jsx)("div",{style:v.footerLink,children:(0,f.jsx)("a",{href:"#login",onClick:e=>{e.preventDefault(),R(!1),L(1),y(null)},style:v.signupLink,children:"Cancel Reset & Go to Login"})})]})]}):M?(0,f.jsxs)("div",{className:"animate-fade-in",children:[(0,f.jsxs)("p",{style:{color:"var(--text-muted)",fontSize:"0.85rem",marginBottom:"20px",textAlign:"center",lineHeight:"1.5"},children:["Your email address is unverified. A 6-digit OTP code has been dispatched to ",(0,f.jsx)("strong",{children:Y})," from ",(0,f.jsx)("em",{children:"[email protected]"}),". Enter it below to activate your account."]}),(0,f.jsxs)("form",{onSubmit:async e=>{if(e.preventDefault(),U){P(!0),y(null);try{const e=await(await fetch("/api/auth/verify-otp",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:Y,otp:U})})).json();P(!1),e.success?(V(!1),y(null),alert("Your email has been successfully verified! You can now log into your account.")):y(e.message)}catch(t){P(!1),y("Connection failed. Try again.")}}else y("Please enter the 6-digit verification code.")},children:[(0,f.jsxs)("div",{className:"form-group",children:[(0,f.jsx)("label",{htmlFor:"login-otp",className:"form-label",style:{textAlign:"center"},children:"6-Digit OTP Code"}),(0,f.jsx)("input",{id:"login-otp",type:"text",maxLength:"6",value:U,onChange:e=>Q(e.target.value.replace(/\D/g,"")),className:"form-control",placeholder:"------",style:{textAlign:"center",fontSize:"1.6rem",fontWeight:"800",letterSpacing:"6px",height:"54px"},required:!0})]}),(0,f.jsx)("button",{type:"submit",className:"btn btn-primary",style:{width:"100%",marginTop:"10px"},disabled:C,children:C?"Activating Account...":"Verify & Activate Account"})]}),(0,f.jsxs)("div",{style:v.resendSection,children:[(0,f.jsx)("p",{style:{color:"var(--text-muted)",fontSize:"0.85rem",marginBottom:"10px",textAlign:"center"},children:"Didn't receive the code?"}),X>0?(0,f.jsxs)("div",{style:v.cooldownBadge,children:[(0,f.jsx)(i,{size:14}),(0,f.jsxs)("span",{children:["Resend available in ",(0,f.jsxs)("strong",{children:[X,"s"]})]})]}):(0,f.jsxs)("button",{type:"button",onClick:async()=>
1{if(!(X>0)){$(!0),y(null);try{const e=await(await fetch("/api/auth/resend-otp",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:Y})})).json();if($(!1),e.success)Q(""),K(60),clearInterval(ee.current),ee.current=setInterval(()=>{K(e=>e<=1?(clearInterval(ee.current),0):e-1)},1e3);else{const t=e.data?.wait_seconds;t&&K(t),y(e.message)}}catch(e){$(!1),y("Failed to resend OTP. Please try again.")}}},disabled:Z,style:v.resendBtn,children:[(0,f.jsx)(t,{size:14,style:{animation:Z?"spin 1s linear infinite":"none"}}),Z?"Sending...":"Resend OTP Code"]})]}),(0,f.jsxs)("div",{style:v.footerLink,children:[(0,f.jsx)("p",{children:"Want to try logging in again?"}),(0,f.jsx)("a",{href:"#login",onClick:e=>{e.preventDefault(),V(!1),y(null)},style:v.signupLink,children:"Return to Login form"})]})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("form",{onSubmit:async t=>{t.preventDefault(),P(!0),y(null);const r=await a(j.email,j.password);if(P(!1),r.success){if(k())return;"admin"===r.role?e("admin-dashboard"):"consultant"===r.role?e("consultant-dashboard"):"branch"===r.role?e("branch-dashboard"):"marketing_agent"===r.role?e("marketing-agent-dashboard"):e("client-dashboard"),window.scrollTo({top:0,behavior:"smooth"})}else r.data?.verification_pending&&(G(j.email),V(!0))},children:[(0,f.jsxs)("div",{className:"form-group",children:[(0,f.jsxs)("label",{htmlFor:"email",className:"form-label",style:v.label,children:[(0,f.jsx)(r,{size:16,style:{color:"var(--accent-gold)"}})," Registered Email"]}),(0,f.jsx)("input",{id:"email",type:"email",name:"email",value:j.email,onChange:te,className:"form-control",placeholder:"e.g. [email protected]",required:!0})]}),(0,f.jsxs)("div",{className:"form-group",style:{marginBottom:"25px"},children:[(0,f.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"},children:[(0,f.jsxs)("label",{htmlFor:"password",className:"form-label",style:{...v.label,marginBottom:0},children:[(0,f.jsx)(l,{size:16,style:{color:"var(--accent-gold)"}})," Account Password"]}),(0,f.jsx)("a",{href:"#forgot-password",onClick:e=>{e.preventDefault(),R(!0),L(1),y(null)},style:{fontSize:"0.8rem",color:"var(--accent-teal)",fontWeight:"600",textDecoration:"none"},children:"Forgot Password?"})]}),(0,f.jsx)("input",{id:"password",type:"password",name:"password",value:j.password,onChange:te,className:"form-control",placeholder:"Enter secure password",required:!0})]}),(0,f.jsx)("button",{type:"submit",className:"btn btn-gold",style:{width:"100%",display:"flex",gap:"8px"},disabled:C,children:C?"Verifying...":(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(n,{size:16})," Enter Secure Portal"]})})]}),b.google_client_id&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("div",{style:v.divider,children:[(0,f.jsx)("span",{style:v.dividerLine}),(0,f.jsx)("span",{style:v.dividerText,children:"or"}),(0,f.jsx)("span",{style:v.dividerLine})]}),(0,f.jsx)("div",{style:v.googleContainer,children:(0,f.jsx)("div",{ref:z,style:{display:"inline-block"}})})]}),(0,f.jsxs)("div",{style:v.footerLink,children:[(0,f.jsx)("p",{children:"Don't have an advisory account yet?"}),(0,f.jsx)("a",{href:"#register",onClick:t=>{t.preventDefault(),e("register")},style:v.signupLink,children:"Register a free client account"})]})]})]})})]}),(0,f.jsx)(h,{setActivePage:e,pageName:"login"})]})}var v={container:{display:"flex",alignItems:"center",justifyContent:"center",padding:"80px 24px",minHeight:"70vh"},loginCard:{width:"100%",maxWidth:"450px",padding:"40px",border:"1px solid var(--border-gold)",boxShadow:"0 20px 50px rgba(10, 19, 36, 0.12)"},header:{textAlign:"center",marginBottom:"30px"},logoImg:{height:"64px",width:"auto",marginBottom:"16px"},title:{fontSize:"1.6rem",color:"var(--primary)",fontWeight:"700"},subtitle:{color:"var(--text-muted)",fontSize:"0.85rem",marginTop:"6px"},label:{display:"flex",alignItems:"center",gap:"6px"},errorBanner:{display:"flex",alignItems:"center",gap:"10px",padding:"12px",borderRadius:"var(--radius-sm)",backgroundColor:"#FEE2E2",color:"#B91C1C",fontSize:"0.85rem",fontWeight:"600",marginBottom:"20px"},footerLink:{textAlign:"center",marginTop:"30px",fontSize:"0.85rem",color:"var(--text-muted)",borderTop:"1px solid var(--border)",paddingTop:"20px"},signupLink:{color:"var(--accent-teal)",fontWeight:"600",marginTop:"4px",display:"inline-block"},resendSection:{textAlign:"center",marginTop:"20px",paddingTop:"16px",borderTop:"1px solid var(--border)",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px"},cooldownBadge:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 16px",background:"var(--bg-cool)",borderRadius:"20px",fontSize:"0.8rem",color:"var(--text-muted)",fontWeight:"600"},resendBtn:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 20px",background:"transparent",border:"1.5px solid var(--accent-teal)",borderRadius:"20px",color:"var(--accent-teal)",fontFamily:"var(--font-heading)",fontWeight:"700",fontSize:"0.85rem",cursor:"pointer",transition:"all 0.2s ease"},divider:{display:"flex",alignItems:"center",justifyContent:"center",margin:"20px 0",gap:"10px"},dividerLine:{flex:1,height:"1px",backgroundColor:"var(--border)"},dividerText:{color:"var(--text-muted)",fontSize:"0.75rem",fontWeight:"700",textTransform:"uppercase",letterSpacing:"1px"},googleContainer:{display:"flex",justifyContent:"center",marginTop:"10px",width:"100%"}};export{y 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.