diff --git a/web/src/app/login/page.tsx b/web/src/app/login/page.tsx
index dabd2ac..ac3c6c8 100644
--- a/web/src/app/login/page.tsx
+++ b/web/src/app/login/page.tsx
@@ -146,6 +146,13 @@ export default function LoginPage() {
{error && }
+
+
+
+ 没有账号?{" "}
+ 立即注册
+
+
diff --git a/web/src/app/register/page.tsx b/web/src/app/register/page.tsx
new file mode 100644
index 0000000..c3ecc29
--- /dev/null
+++ b/web/src/app/register/page.tsx
@@ -0,0 +1,154 @@
+"use client";
+
+import { IdcardOutlined, LockOutlined, MailOutlined, UserOutlined } from "@ant-design/icons";
+import { ChangeEvent, FormEvent, useEffect, useState } from "react";
+import { useRouter } from "next/navigation";
+import { Alert, Button, Input, Space, Typography } from "antd";
+
+import { useAuth } from "@/components/auth-provider";
+import { Card } from "@/components/ui-antd";
+import { withBasePath } from "@/lib/base-path";
+
+export default function RegisterPage() {
+ const router = useRouter();
+ const { user, initializing, register } = useAuth();
+
+ const [email, setEmail] = useState("");
+ const [username, setUsername] = useState("");
+ const [password, setPassword] = useState("");
+ const [confirmPassword, setConfirmPassword] = useState("");
+ const [busy, setBusy] = useState(false);
+ const [error, setError] = useState("");
+
+ useEffect(() => {
+ if (!initializing && user) {
+ router.replace("/users");
+ }
+ }, [initializing, router, user]);
+
+ const handleSubmit = async (event: FormEvent) => {
+ event.preventDefault();
+ setError("");
+
+ if (password !== confirmPassword) {
+ setError("两次输入的密码不一致");
+ return;
+ }
+
+ if (password.length < 8) {
+ setError("密码长度至少为 8 个字符");
+ return;
+ }
+
+ setBusy(true);
+
+ try {
+ await register(email, username, password);
+ } catch (submitError) {
+ const message = submitError instanceof Error ? submitError.message : "未知错误";
+ setError(message);
+ } finally {
+ setBusy(false);
+ }
+ };
+
+ if (initializing) {
+ return (
+
+ 正在初始化会话...
+
+ );
+ }
+
+ if (user) {
+ return (
+
+ 正在跳转到控制台...
+
+ );
+ }
+
+ return (
+
+
+
+
+
})
+
+
+
+ 用户注册
+
+
+
+
+ {error && }
+
+
+
+ 已有账号?{" "}
+ 立即登录
+
+
+
+
+
+ );
+}