Files
chinese-family-tree-2/.next/server/chunks/ssr/Documents_go-new_chinese-family-tree_af55a272._.js
T
freedakgmail 3d075c6076 0.0.8.5
2025-11-24 14:02:34 +08:00

3 lines
3.2 KiB
JavaScript

module.exports=[12576,(a,b,c)=>{"use strict";b.exports=a.r(81232).vendored["react-ssr"].ReactServerDOMTurbopackClient},888,a=>{"use strict";var b=a.i(6155),c=a.i(54297),d=a.i(14672),e=a.i(31483),f=a.i(8895),g=a.i(59580),h=a.i(85801),i=a.i(99766),j=a.i(24749),k=a.i(38076);function l(){let a=(0,d.useRouter)(),[l,m]=(0,c.useState)(""),[n,o]=(0,c.useState)(""),[p,q]=(0,c.useState)(""),[r,s]=(0,c.useState)(""),[t,u]=(0,c.useState)(""),[v,w]=(0,c.useState)(!1),x=async b=>{if(b.preventDefault(),u(""),p!==r)return void u("两次输入的密码不一致");if(p.length<6)return void u("密码至少需要6个字符");w(!0);try{let b=await fetch("/api/auth/register",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:l,email:n,password:p})}),c=await b.json();if(!b.ok)return void u(c.error||"注册失败");a.push("/auth/signin?registered=true")}catch(a){u("注册失败,请稍后重试")}finally{w(!1)}};return(0,b.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 via-background to-secondary/5 p-4",children:(0,b.jsxs)(i.Card,{className:"w-full max-w-md",children:[(0,b.jsxs)(i.CardHeader,{className:"space-y-1 text-center",children:[(0,b.jsx)("div",{className:"flex justify-center mb-4",children:(0,b.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-lg bg-primary text-primary-foreground",children:(0,b.jsx)(k.BookOpen,{className:"h-7 w-7"})})}),(0,b.jsx)(i.CardTitle,{className:"text-2xl font-serif",children:"注册"}),(0,b.jsx)(i.CardDescription,{children:"创建您的华夏谱账号"})]}),(0,b.jsxs)("form",{onSubmit:x,children:[(0,b.jsxs)(i.CardContent,{className:"space-y-4",children:[t&&(0,b.jsx)(j.Alert,{variant:"destructive",children:(0,b.jsx)(j.AlertDescription,{children:t})}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(h.Label,{htmlFor:"name",children:"姓名"}),(0,b.jsx)(g.Input,{id:"name",type:"text",placeholder:"张三",value:l,onChange:a=>m(a.target.value),disabled:v})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(h.Label,{htmlFor:"email",children:"邮箱"}),(0,b.jsx)(g.Input,{id:"email",type:"email",placeholder:"请输入邮箱",value:n,onChange:a=>o(a.target.value),required:!0,disabled:v})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(h.Label,{htmlFor:"password",children:"密码"}),(0,b.jsx)(g.Input,{id:"password",type:"password",placeholder:"至少6个字符",value:p,onChange:a=>q(a.target.value),required:!0,disabled:v})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(h.Label,{htmlFor:"confirmPassword",children:"确认密码"}),(0,b.jsx)(g.Input,{id:"confirmPassword",type:"password",placeholder:"再次输入密码",value:r,onChange:a=>s(a.target.value),required:!0,disabled:v})]})]}),(0,b.jsxs)(i.CardFooter,{className:"flex flex-col space-y-4 pt-6",children:[(0,b.jsx)(f.Button,{type:"submit",className:"w-full",disabled:v,children:v?"注册中...":"注册"}),(0,b.jsxs)("div",{className:"text-sm text-center text-muted-foreground",children:["已有账号?"," ",(0,b.jsx)(e.default,{href:"/auth/signin",className:"text-primary hover:underline",children:"立即登录"})]})]})]})]})})}a.s(["default",()=>l])}];
//# sourceMappingURL=Documents_go-new_chinese-family-tree_af55a272._.js.map