From 85c29ec1ef441b96b6f0692f3087912ae4d8a324 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=B7=E9=BE=99?= Date: Thu, 28 Aug 2025 23:27:03 +0800 Subject: [PATCH] =?UTF-8?q?=E9=95=9C=E5=A4=B4=E6=96=87=E4=BB=B6=E5=92=8C?= =?UTF-8?q?=E4=B8=80=E4=BA=9B=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/signup/page.tsx | 71 ++++++++++++++++-------- components/pages/login.tsx | 88 +++++++++++++++++++----------- next.config.js | 5 ++ public/googleecc00f8952ff351c.html | 1 + 4 files changed, 108 insertions(+), 57 deletions(-) create mode 100644 public/googleecc00f8952ff351c.html diff --git a/app/signup/page.tsx b/app/signup/page.tsx index 65f28e5..b7a41a4 100644 --- a/app/signup/page.tsx +++ b/app/signup/page.tsx @@ -1,24 +1,24 @@ -'use client'; +"use client"; -import React, { useState } from 'react'; -import { useRouter } from 'next/navigation'; -import Link from 'next/link'; -import { signInWithGoogle, registerUser } from '@/lib/auth'; -import { GradientText } from '@/components/ui/gradient-text'; +import React, { useState } from "react"; +import { useRouter } from "next/navigation"; +import Link from "next/link"; +import { signInWithGoogle, registerUser } from "@/lib/auth"; +import { GradientText } from "@/components/ui/gradient-text"; export default function SignupPage() { - const [name, setName] = useState(''); - const [email, setEmail] = useState(''); - const [password, setPassword] = useState(''); - const [inviteCode, setInviteCode] = useState(''); + const [name, setName] = useState(""); + const [email, setEmail] = useState(""); + const [password, setPassword] = useState(""); + const [inviteCode, setInviteCode] = useState(""); const [isSubmitting, setIsSubmitting] = useState(false); - const [formError, setFormError] = useState(''); + const [formError, setFormError] = useState(""); const router = useRouter(); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setIsSubmitting(true); - setFormError(''); + setFormError(""); try { // Use new registration API @@ -30,10 +30,10 @@ export default function SignupPage() { }); // Redirect to login page after successful registration - router.push('/login?registered=true'); + router.push("/login?registered=true"); } catch (error: any) { - console.error('Signup error:', error); - setFormError('Registration failed, please try again'); + console.error("Signup error:", error); + setFormError("Registration failed, please try again"); } finally { setIsSubmitting(false); } @@ -58,10 +58,17 @@ export default function SignupPage() { {/* 视频遮罩层 */} -
+
{/* Logo */} -
+
router.push("/")} + >
-

Sign Up, for free

+

+ Sign Up, for free +

Create your account to get started

- +
- +
- +
- + - {isSubmitting ? 'Signing up...' : 'Sign Up'} + {isSubmitting ? "Signing up..." : "Sign Up"}
@@ -170,7 +187,13 @@ export default function SignupPage() {

- Already have an account? Login + Already have an account?{" "} + + Login +

diff --git a/components/pages/login.tsx b/components/pages/login.tsx index 7865b6f..92ca8f4 100644 --- a/components/pages/login.tsx +++ b/components/pages/login.tsx @@ -1,37 +1,39 @@ -'use client'; +"use client"; -import { useState, useCallback, useEffect } from 'react'; -import './style/login.css'; -import { useRouter, useSearchParams } from 'next/navigation'; -import React from 'react'; -import Link from 'next/link'; -import { signInWithGoogle, loginUser } from '@/lib/auth'; -import { GradientText } from '@/components/ui/gradient-text'; -import { Eye, EyeOff } from 'lucide-react'; +import { useState, useCallback, useEffect } from "react"; +import "./style/login.css"; +import { useRouter, useSearchParams } from "next/navigation"; +import React from "react"; +import Link from "next/link"; +import { signInWithGoogle, loginUser } from "@/lib/auth"; +import { GradientText } from "@/components/ui/gradient-text"; +import { Eye, EyeOff } from "lucide-react"; export default function Login() { - const [email, setEmail] = useState(''); - const [password, setPassword] = useState(''); + const [email, setEmail] = useState(""); + const [password, setPassword] = useState(""); const [showPassword, setShowPassword] = useState(false); const [isSubmitting, setIsSubmitting] = useState(false); - const [formError, setFormError] = useState(''); - const [successMessage, setSuccessMessage] = useState(''); + const [formError, setFormError] = useState(""); + const [successMessage, setSuccessMessage] = useState(""); const router = useRouter(); const searchParams = useSearchParams(); // Check for registered=true parameter useEffect(() => { - const registered = searchParams?.get('registered'); - if (registered === 'true') { - setSuccessMessage('Registration successful! Please login with your new account.'); + const registered = searchParams?.get("registered"); + if (registered === "true") { + setSuccessMessage( + "Registration successful! Please login with your new account." + ); } - const error = searchParams?.get('error'); + const error = searchParams?.get("error"); if (error) { - if (error === 'google_oauth') { - setFormError('Google login failed, please try again.'); - } else if (error === 'auth_failed') { - setFormError('Authentication failed, please try again.'); + if (error === "google_oauth") { + setFormError("Google login failed, please try again."); + } else if (error === "auth_failed") { + setFormError("Authentication failed, please try again."); } } }, [searchParams]); @@ -43,18 +45,20 @@ export default function Login() { const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setIsSubmitting(true); - setFormError(''); - setSuccessMessage(''); + setFormError(""); + setSuccessMessage(""); try { await loginUser(email, password); // 登录成功后跳转到首页 - router.push('/'); + router.push("/"); } catch (error: any) { - console.error('Login failed:', error); + console.error("Login failed:", error); // 根据错误类型显示不同的错误消息 - setFormError('Login failed, please check your credentials and try again.'); + setFormError( + "Login failed, please check your credentials and try again." + ); } finally { setIsSubmitting(false); } @@ -76,10 +80,17 @@ export default function Login() { {/* 视频遮罩层 */} -
+
{/* Logo */} -
+
router.push("/")} + >

Login

-

Enter your credentials to access your account

+

+ Enter your credentials to access your account +

@@ -140,7 +153,13 @@ export default function Login() {
@@ -155,9 +174,9 @@ export default function Login() { className="w-full mt-4 btn btn-primary" disabled={isSubmitting} > - {isSubmitting ? 'Logging in...' : 'Login'} + {isSubmitting ? "Logging in..." : "Login"} -{/* + {/*
or @@ -175,7 +194,10 @@ export default function Login() {

- Don't have an account? Sign up + Don't have an account?{" "} + + Sign up +

diff --git a/next.config.js b/next.config.js index f8c5a87..dce7dad 100644 --- a/next.config.js +++ b/next.config.js @@ -47,6 +47,11 @@ const nextConfig = { }, ]; }, + + // 确保静态文件可以正常访问 + experimental: { + staticPageGenerationTimeout: 120, + }, }; module.exports = nextConfig; diff --git a/public/googleecc00f8952ff351c.html b/public/googleecc00f8952ff351c.html new file mode 100644 index 0000000..1323c17 --- /dev/null +++ b/public/googleecc00f8952ff351c.html @@ -0,0 +1 @@ +google-site-verification: googleecc00f8952ff351c.html \ No newline at end of file