PageSourceSearch

https://www.ylive.ai/assets/Auth-CP9Y2xpc.js

js ylive.ai collected 2026-10-05 13:44:42 UTC 9,753 bytes, 1 lines download raw bytes

1import{j as e,r as l}from"./vendor-motion-IPZE8IrO.js";import{u as N,t as h,a2 as w,a3 as v,j as x,a4 as P,I as m,B as b,a5 as S,a6 as E}from"./index-AEzrcV_C.js";import"./vendor-react-BN0qJr-I.js";import"./vendor-trpc-IjFHpi-5.js";const j=a=>new URLSearchParams(window.location.search).get(a)||"",u=()=>w(j("return")),f=a=>P(a,u());function A(){const a=S(window.localStorage.getItem(E)),t=typeof a?.displayName=="string"?a.displayName.trim():"";return t.length>=2?t:""}function g({title:a,subtitle:t,children:n}){return e.jsx("div",{className:"atlas-auth-shell",children:e.jsxs("div",{className:"atlas-auth-card",children:[e.jsx("a",{href:"/",className:"atlas-auth-card__brand","aria-label":"Ylive Atlas AI — kembali ke beranda",children:e.jsxs("span",{className:"atlas-platform-lockup","aria-hidden":"true",children:[e.jsx("span",{className:"atlas-platform-lockup__symbol",children:e.jsx("img",{src:"/assets/brand/ylive-atlas-ai-approved-direction.png",alt:""})}),e.jsxs("span",{className:"atlas-platform-lockup__name",children:["Ylive ",e.jsx("em",{children:"Atlas AI"})]})]})}),e.jsx("span",{className:"atlas-auth-card__parent",children:"by Ylive Academy"}),e.jsx("h1",{className:"mt-7",children:a}),e.jsx("p",{className:"text-muted-foreground mt-2 mb-7",children:t}),n,e.jsx("p",{className:"text-xs text-muted-foreground text-center mt-7",children:"Platform edukasi dan literasi finansial syariah."})]})})}const y=({error:a})=>a?e.jsx("div",{className:"rounded-lg bg-destructive/10 border border-destructive/30 px-4 py-3 text-sm text-destructive mb-4",children:a instanceof Error?a.message:"Terjadi kesalahan."}):null;function I(){const[a]=N();return a==="/register"?e.jsx(_,{}):a==="/forgot-password"?e.jsx(D,{}):a==="/reset-password"?e.jsx(R,{}):a==="/verify-account"?e.jsx(L,{}):e.jsx(C,{})}function M(){const a=u(),t=a?`/api/auth/google?returnPath=${encodeURIComponent(a)}`:"/api/auth/google";return e.jsxs("a",{href:t,className:"flex items-center justify-center gap-2.5 w-full rounded-lg border border-border bg-card px-4 py-2.5 text-sm font-semibold text-foreground transition-colors hover:bg-muted",children:[e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 48 48","aria-hidden":"true",children:[e.jsx("path",{fill:"#EA4335",d:"M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z"}),e.jsx("path",{fill:"#4285F4",d:"M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z"}),e.jsx("path",{fill:"#FBBC05",d:"M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z"}),e.jsx("path",{fill:"#34A853",d:"M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.18 1.48-4.97 2.31-8.16 2.31-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z"})]}),"Masuk dengan Google"]})}function C(){const[a,t]=l.useState(""),[n,r]=l.useState(""),s=new URLSearchParams(window.location.search).get("error"),i=h.useUtils(),o=h.auth.login.useMutation({onSuccess:async d=>{u().includes("atlas-journey-v2")&&v("sharia_login_completed",{source:"login"}),await i.auth.me.invalidate(),window.location.href=d.returnPath||u()}});return e.jsxs(g,{title:"Selamat Datang",subtitle:"Masuk dengan akun Ylive Anda.",children:[s&&e.jsx("div",{className:"rounded-lg bg-destructive/10 border border-destructive/30 px-4 py-3 text-sm text-destructive mb-4",children:"Login gagal. Silakan coba lagi."}),e.jsx("div",{className:"space-y-2 mb-5",children:e.jsx(M,{})}),e.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[e.jsx("div",{className:"flex-1 h-px bg-border"}),e.jsx("span",{className:"text-xs text-muted-foreground uppercase tracking-widest font-medium",children:"atau"}),e.jsx("div",{className:"flex-1 h-px bg-border"})]}),e.jsx(y,{error:o.error}),e.jsxs("form",{className:"space-y-4",onSubmit:d=>{d.preventDefault(),o.mutate({email:a,password:n,returnPath:u()})},children:[e.jsxs("label",{className:"block text-sm text-muted-foreground",children:["Email",e.jsx(m,{className:"mt-2 bg-muted border-border",type:"email",autoComplete:"email",required:!0,value:a,onChange:d=>t(d.target.value)})]}),e.jsxs("label",{className:"block text-sm text-muted-foreground",children:["Password",e.jsx(m,{className:"mt-2 bg-muted border-border",type:"password",autoComplete:"current-password",required:!0,value:n,onChange:d=>r(d.target.value)})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(x,{href:"/forgot-password",className:"text-sm text-primary hover:underline",children:"Lupa password?"})}),e.jsx(b,{disabled:o.isPending,className:"w-full bg-primary hover:bg-emerald-dark text-primary-foreground font-bold",children:o.isPending?"Memproses...":"Masuk"})]}),e.jsxs("p",{className:"text-center text-sm text-muted-foreground mt-6",children:["Belum punya akun? ",e.jsx(x,{href:f("/register"),className:"text-primary font-semibold",children:"Daftar"})]})]})}function _(){const a=A(),[t,n]=l.useState(()=>a||j("name")),[r,s]=l.useState(""),[i,o]=l.useState(""),[d,k]=l.useState(!1),p=h.auth.register.useMutation({onSuccess:()=>{u().includes("atlas-journey-v2")&&v("sharia_registration_submitted",{source:"registration"}),k(!0)}});
1return d?e.jsxs(g,{title:"Periksa Email",subtitle:"Tautan verifikasi telah dikirim.",children:[e.jsxs("div",{className:"rounded-xl border border-primary/30 bg-primary/10 p-5 text-gray-200",children:["Buka email ",e.jsx("strong",{children:r}),', lalu klik "Verifikasi Akun".']}),e.jsx(x,{href:f("/login"),className:"block text-center mt-6 text-primary",children:"Kembali ke Login"})]}):e.jsxs(g,{title:"Buat Akun Ylive",subtitle:"Mulai perjalanan belajar finansial syariah.",children:[e.jsx(y,{error:p.error}),e.jsxs("form",{className:"space-y-4",onSubmit:c=>{c.preventDefault(),p.mutate({name:t,email:r,password:i,returnPath:u()})},children:[a?e.jsxs("div",{className:"rounded-xl border border-primary/20 bg-primary/10 px-4 py-3 text-sm text-gray-200",children:["Nama dari Journey: ",e.jsx("strong",{children:a})]}):e.jsxs("label",{className:"block text-sm text-muted-foreground",children:["Nama",e.jsx(m,{className:"mt-2 bg-muted border-border",autoComplete:"name",required:!0,minLength:2,value:t,onChange:c=>n(c.target.value)})]}),e.jsxs("label",{className:"block text-sm text-muted-foreground",children:["Email",e.jsx(m,{className:"mt-2 bg-muted border-border",type:"email",autoComplete:"email",required:!0,value:r,onChange:c=>s(c.target.value)})]}),e.jsxs("label",{className:"block text-sm text-muted-foreground",children:["Password",e.jsx(m,{className:"mt-2 bg-muted border-border",type:"password",autoComplete:"new-password",required:!0,minLength:10,value:i,onChange:c=>o(c.target.value)})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Minimal 10 karakter, huruf besar, huruf kecil, dan angka."}),e.jsx(b,{disabled:p.isPending||t.trim().length<2,className:"w-full bg-primary hover:bg-emerald-dark text-primary-foreground font-bold",children:p.isPending?"Membuat akun...":"Daftar"})]}),e.jsxs("p",{className:"text-center text-sm text-muted-foreground mt-6",children:["Sudah punya akun? ",e.jsx(x,{href:f("/login"),className:"text-primary font-semibold",children:"Masuk"})]})]})}function L(){const a=j("token"),[t,n]=l.useState("Memverifikasi akun..."),r=h.auth.verifyEmail.useMutation({onSuccess:s=>{s.returnPath.includes("atlas-journey-v2")&&v("sharia_verification_completed",{source:"verification"}),n("Email berhasil diverifikasi. Mengarahkan ke perjalanan Anda..."),setTimeout(()=>window.location.href=s.returnPath,800)},onError:s=>n(s.message)});return l.useEffect(()=>{a&&!r.isPending&&!r.isSuccess&&!r.isError&&r.mutate({token:a,returnPath:u()})},[a]),e.jsxs(g,{title:"Verifikasi Akun",subtitle:t,children:[!a&&e.jsx("div",{className:"text-destructive",children:"Token tidak tersedia."}),e.jsx(x,{href:f("/login"),className:"block text-center mt-6 text-primary",children:"Ke halaman Login"})]})}function D(){const[a,t]=l.useState(""),[n,r]=l.useState(!1),s=h.auth.forgotPassword.useMutation({onSuccess:()=>r(!0)});return e.jsxs(g,{title:"Lupa Password",subtitle:"Kami akan mengirim tautan reset bila email terdaftar.",children:[n?e.jsx("div",{className:"rounded-xl bg-primary/10 border border-primary/30 p-5",children:"Periksa inbox dan folder spam Anda."}):e.jsxs("form",{className:"space-y-4",onSubmit:i=>{i.preventDefault(),s.mutate({email:a})},children:[e.jsx(y,{error:s.error}),e.jsx(m,{className:"bg-muted border-border",type:"email",required:!0,placeholder:"Email",value:a,onChange:i=>t(i.target.value)}),e.jsx(b,{className:"w-full bg-primary text-primary-foreground font-bold",disabled:s.isPending,children:"Kirim Tautan Reset"})]}),e.jsx(x,{href:"/login",className:"block text-center mt-6 text-primary",children:"Kembali ke Login"})]})}function R(){const a=j("token"),[t,n]=l.useState(""),[r,s]=l.useState(!1),i=h.auth.resetPassword.useMutation({onSuccess:()=>s(!0)});return e.jsx(g,{title:"Password Baru",subtitle:"Buat password kuat untuk akun Ylive Anda.",children:r?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"rounded-xl bg-primary/10 border border-primary/30 p-5",children:"Password berhasil diperbarui."}),e.jsx(x,{href:"/login",className:"block text-center mt-6 text-primary",children:"Login Sekarang"})]}):e.jsxs("form",{className:"space-y-4",onSubmit:o=>{o.preventDefault(),i.mutate({token:a,password:t})},children:[e.jsx(y,{error:i.error}),e.jsx(m,{className:"bg-muted border-border",type:"password",required:!0,minLength:10,placeholder:"Password baru",value:t,onChange:o=>n(o.target.value)}),e.jsx(b,{className:"w-full bg-primary text-primary-foreground font-bold",disabled:!a||i.isPending,children:"Simpan Password"})]})})}export{I 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.