diff --git a/src/pages/AuthPage/AuthPage.jsx b/src/pages/AuthPage/AuthPage.jsx
index 1aa7b24..4c51ff9 100644
--- a/src/pages/AuthPage/AuthPage.jsx
+++ b/src/pages/AuthPage/AuthPage.jsx
@@ -1,25 +1,3 @@
-// import React, { useState } from 'react';
-// import Login from '../../components/Auth/Login';
-// import Register from '../../components/Auth/Register';
-
-// const AuthPage = () => {
-//   const [isRegister, setIsRegister] = useState(false);
-
-//   return (
-//     <div>
-//       {isRegister ? (
-//         <Register onLoginClick={() => setIsRegister(false)} />
-//       ) : (
-//         <Login onRegisterClick={() => setIsRegister(true)} />
-//       )}
-//     </div>
-//   );
-// };
-
-// export default AuthPage;
-
-
-
 import { useState } from "react";
 import { Link } from "wouter";
 import "./AuthPage.css";
@@ -43,7 +21,6 @@
     password: "",
     confirmPassword: "",
     inviteCode: "",
-    agreeTerms: false,
   });
 
   // Form errors
@@ -58,129 +35,114 @@
 
   // Handle login form submission
   const handleLogin = async (e) => {
-    e.preventDefault();
+  e.preventDefault();
 
-    // 客户端验证
-    const newErrors = {};
-    if (!loginData.username) {
-      newErrors.username = "请输入用户名或邮箱";
+  const newErrors = {};
+  if (!loginData.username) {
+    newErrors.username = "请输入用户名或邮箱";
+  }
+  if (!loginData.password) {
+    newErrors.password = "请输入密码";
+  }
+
+  if (Object.keys(newErrors).length > 0) {
+    setErrors((prev) => ({ ...prev, login: newErrors }));
+    return;
+  }
+
+  try {
+    const response = await fetch("/echo/user/login", {
+      method: 'POST',
+      headers: {
+        'Content-Type': 'application/json',
+      },
+      body: JSON.stringify({
+        username: loginData.username,
+        password: loginData.password,
+      }),
+    });
+
+    const data = await response.json();
+
+    if (data.msg === "登录成功" && data.user) {
+      // 保存用户信息到 localStorage
+      localStorage.setItem("user", JSON.stringify(data.user));
+      localStorage.setItem("userId", data.user.id); // 如果有 id 字段
+      window.location.href = '/forum';
+    } else {
+      throw new Error(data.msg || "登录失败");
     }
-    if (!loginData.password) {
-      newErrors.password = "请输入密码";
-    }
+  } catch (error) {
+    console.error('登录错误:', error.message);
+    setErrors((prev) => ({
+      ...prev,
+      login: { message: error.message },
+    }));
+  }
+};
 
-    if (Object.keys(newErrors).length > 0) {
-      setErrors((prev) => ({ ...prev, login: newErrors }));
-      return;
-    }
-
-    // 加密密码
-    const hashedPassword = hashPassword(loginData.password);
-
-    try {
-      const response = await fetch(`/echo/user/login`, {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          username: loginData.username,
-          password: hashedPassword,
-        }),
-      });
-
-      if (!response.ok) {
-        throw new Error('登录失败');
-      }
-
-      const data = await response.json();
-      
-      if (data.code !== 0 || !data.result) {
-        throw new Error(data.msg || '登录失败');
-      }
-
-      console.log('登录成功:', data);
-      localStorage.setItem('token', data.rows.token);
-      localStorage.setItem('userId', data.rows.userId);
-      window.location.href = '/';
-    } catch (error) {
-      console.error('登录错误:', error.message);
-      setErrors((prev) => ({
-        ...prev,
-        login: { message: error.message },
-      }));
-      throw error;
-    }
-  };
 
   // Handle register form submission
   const handleRegister = async (e) => {
-    e.preventDefault();
+  e.preventDefault();
 
-    // 客户端验证
-    const newErrors = {};
-    if (!registerData.username) {
-      newErrors.username = "请输入用户名";
-    }
-    if (!registerData.email) {
-      newErrors.email = "请输入邮箱";
-    } else if (!/\S+@\S+\.\S+/.test(registerData.email)) {
-      newErrors.email = "邮箱格式不正确";
-    }
-    if (!registerData.password) {
-      newErrors.password = "请输入密码";
-    } else if (registerData.password.length < 6) {
-      newErrors.password = "密码长度至少为6位";
-    }
-    if (registerData.password !== registerData.confirmPassword) {
-      newErrors.confirmPassword = "两次输入的密码不一致";
-    }
-    if (!registerData.agreeTerms) {
-      newErrors.agreeTerms = "请同意用户协议和隐私政策";
-    }
+  const newErrors = {};
+  if (!registerData.username) {
+    newErrors.username = "请输入用户名";
+  }
+  if (!registerData.email) {
+    newErrors.email = "请输入邮箱";
+  } else if (!/\S+@\S+\.\S+/.test(registerData.email)) {
+    newErrors.email = "邮箱格式不正确";
+  }
+  if (!registerData.password) {
+    newErrors.password = "请输入密码";
+  } else if (registerData.password.length < 6) {
+    newErrors.password = "密码长度至少为6位";
+  }
+  if (registerData.password !== registerData.confirmPassword) {
+    newErrors.confirmPassword = "两次输入的密码不一致";
+  }
 
-    if (Object.keys(newErrors).length > 0) {
-      setErrors({ ...errors, register: newErrors });
-      return;
+  if (Object.keys(newErrors).length > 0) {
+    setErrors((prev) => ({ ...prev, register: newErrors }));
+    return;
+  }
+
+  const hashedPassword = hashPassword(registerData.password);
+
+  try {
+    const response = await fetch("/echo/user/register", {
+      method: 'POST',
+      headers: {
+        'Content-Type': 'application/json',
+      },
+      body: JSON.stringify({
+        username: registerData.username,
+        email: registerData.email,
+        password: hashedPassword,
+        role: "user", // 默认角色，可根据实际情况调整
+        inviteCode: registerData.inviteCode,
+      }),
+    });
+
+    const data = await response.json();
+
+    if (data.msg === "注册成功") {
+      alert("注册成功，请登录！");
+      setActiveTab("login");
+    } else {
+      throw new Error(data.msg || "注册失败");
     }
+  } catch (error) {
+    console.error("注册错误:", error.message);
+    setErrors((prev) => ({
+      ...prev,
+      register: { message: error.message },
+    }));
+  }
+};
 
-    // 加密密码
-    const hashedPassword = hashPassword(registerData.password);
-
-    try {
-      const response = await fetch(`/echo/user/register`, {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          username: registerData.username,
-          email: registerData.email,
-          password: hashedPassword, 
-          inviteCode: registerData.inviteCode,
-        }),
-      });
-
-      if (!response.ok) {
-        throw new Error('注册失败');
-      }
-
-      const data = await response.json();
-      if (data.code !== 0 || !data.result) {
-        throw new Error(data.msg || '注册失败');
-      }
-
-      console.log('注册成功:', data);
-      setActiveTab('login');
-      alert('注册成功，请登录！');
-    } catch (error) {
-      console.error('注册错误:', error.message);
-      setErrors((prev) => ({
-        ...prev,
-        register: { message: error.message },
-      }));
-    }
-  };
 
   // Update login form data
   const updateLoginData = (field, value) => {
@@ -208,6 +170,7 @@
           <div className={`auth-tab ${activeTab === "register" ? "active" : ""}`} onClick={() => setActiveTab("register")}>
             注册
           </div>
+
         </div>
 
         <div className="auth-content">
