forked from 77media/video-flow
镜头文件和一些修改
This commit is contained in:
parent
19f24dacfc
commit
85c29ec1ef
@ -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<HTMLFormElement>) => {
|
||||
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() {
|
||||
</video>
|
||||
|
||||
{/* 视频遮罩层 */}
|
||||
<div className="absolute inset-0 bg-black/20" data-alt="video-overlay"></div>
|
||||
<div
|
||||
className="absolute inset-0 bg-black/20"
|
||||
data-alt="video-overlay"
|
||||
></div>
|
||||
|
||||
{/* Logo */}
|
||||
<div className="absolute top-8 left-8 z-10" data-alt="logo-container">
|
||||
<div
|
||||
className="absolute top-8 left-8 z-50"
|
||||
data-alt="logo-container"
|
||||
onClick={() => router.push("/")}
|
||||
>
|
||||
<span className="logo-heart">
|
||||
<GradientText
|
||||
text="MovieFlow"
|
||||
@ -79,13 +86,17 @@ export default function SignupPage() {
|
||||
<div className="relative bottom-4 z-10 flex items-center justify-center min-h-screen p-4">
|
||||
<div className="max-w-md w-full bg-black/40 backdrop-blur-lg border border-white/20 rounded-2xl p-8 shadow-2xl">
|
||||
<div className="text-center mb-6">
|
||||
<h2 className="text-2xl font-bold text-white mb-4">Sign Up, for free</h2>
|
||||
<h2 className="text-2xl font-bold text-white mb-4">
|
||||
Sign Up, for free
|
||||
</h2>
|
||||
<p className="text-gray-300">Create your account to get started</p>
|
||||
</div>
|
||||
|
||||
<form onSubmit={handleSubmit} className="space-y-4">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-white mb-1">Name</label>
|
||||
<label className="block text-sm font-medium text-white mb-1">
|
||||
Name
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Your name"
|
||||
@ -97,7 +108,9 @@ export default function SignupPage() {
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-white mb-1">Email</label>
|
||||
<label className="block text-sm font-medium text-white mb-1">
|
||||
Email
|
||||
</label>
|
||||
<input
|
||||
type="email"
|
||||
placeholder="your@email.com"
|
||||
@ -109,7 +122,9 @@ export default function SignupPage() {
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-white mb-1">Password</label>
|
||||
<label className="block text-sm font-medium text-white mb-1">
|
||||
Password
|
||||
</label>
|
||||
<input
|
||||
type="password"
|
||||
placeholder="Password"
|
||||
@ -121,7 +136,9 @@ export default function SignupPage() {
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-white mb-1">Invite Code (Optional)</label>
|
||||
<label className="block text-sm font-medium text-white mb-1">
|
||||
Invite Code (Optional)
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Enter invite code if you have one"
|
||||
@ -149,7 +166,7 @@ export default function SignupPage() {
|
||||
disabled={isSubmitting}
|
||||
className="flex-1 py-3 rounded-lg bg-purple-600 hover:bg-purple-700 text-white font-medium transition-colors disabled:opacity-70"
|
||||
>
|
||||
{isSubmitting ? 'Signing up...' : 'Sign Up'}
|
||||
{isSubmitting ? "Signing up..." : "Sign Up"}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
@ -170,7 +187,13 @@ export default function SignupPage() {
|
||||
|
||||
<div className="text-center mt-4">
|
||||
<p style={{ color: "rgba(255, 255, 255, 0.6)" }}>
|
||||
Already have an account? <Link href="/login" className="text-purple-400 hover:text-purple-300">Login</Link>
|
||||
Already have an account?{" "}
|
||||
<Link
|
||||
href="/login"
|
||||
className="text-purple-400 hover:text-purple-300"
|
||||
>
|
||||
Login
|
||||
</Link>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -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<HTMLFormElement>) => {
|
||||
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() {
|
||||
</video>
|
||||
|
||||
{/* 视频遮罩层 */}
|
||||
<div className="absolute inset-0 bg-black/20 " data-alt="video-overlay"></div>
|
||||
<div
|
||||
className="absolute inset-0 bg-black/20 "
|
||||
data-alt="video-overlay"
|
||||
></div>
|
||||
|
||||
{/* Logo */}
|
||||
<div className="absolute top-8 left-8 z-10" data-alt="logo-container">
|
||||
<div
|
||||
className="absolute top-8 left-8 z-50"
|
||||
data-alt="logo-container"
|
||||
onClick={() => router.push("/")}
|
||||
>
|
||||
<span className="logo-heart">
|
||||
<GradientText
|
||||
text="MovieFlow"
|
||||
@ -98,7 +109,9 @@ export default function Login() {
|
||||
<div className="auth-container max-w-md w-full bg-black/40 backdrop-blur-lg border border-white/20 rounded-2xl p-8 shadow-2xl">
|
||||
<div className="auth-header text-center mb-6">
|
||||
<h2 className="text-2xl font-bold text-white pb-4">Login</h2>
|
||||
<p className="text-gray-300">Enter your credentials to access your account</p>
|
||||
<p className="text-gray-300">
|
||||
Enter your credentials to access your account
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<form onSubmit={handleSubmit}>
|
||||
@ -140,7 +153,13 @@ export default function Login() {
|
||||
</button>
|
||||
</div>
|
||||
<div className="flex justify-end mt-2">
|
||||
<a className="auth-link small" href="/forgot-password" data-discover="true">Forgot password?</a>
|
||||
<a
|
||||
className="auth-link small"
|
||||
href="/forgot-password"
|
||||
data-discover="true"
|
||||
>
|
||||
Forgot password?
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -155,7 +174,7 @@ export default function Login() {
|
||||
className="w-full mt-4 btn btn-primary"
|
||||
disabled={isSubmitting}
|
||||
>
|
||||
{isSubmitting ? 'Logging in...' : 'Login'}
|
||||
{isSubmitting ? "Logging in..." : "Login"}
|
||||
</button>
|
||||
{/*
|
||||
<div className="my-4 relative flex items-center">
|
||||
@ -175,7 +194,10 @@ export default function Login() {
|
||||
|
||||
<div className="text-center mt-4">
|
||||
<p style={{ color: "rgba(255, 255, 255, 0.6)" }}>
|
||||
Don't have an account? <Link href="/signup" className="auth-link">Sign up</Link>
|
||||
Don't have an account?{" "}
|
||||
<Link href="/signup" className="auth-link">
|
||||
Sign up
|
||||
</Link>
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@ -47,6 +47,11 @@ const nextConfig = {
|
||||
},
|
||||
];
|
||||
},
|
||||
|
||||
// 确保静态文件可以正常访问
|
||||
experimental: {
|
||||
staticPageGenerationTimeout: 120,
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = nextConfig;
|
||||
|
||||
1
public/googleecc00f8952ff351c.html
Normal file
1
public/googleecc00f8952ff351c.html
Normal file
@ -0,0 +1 @@
|
||||
google-site-verification: googleecc00f8952ff351c.html
|
||||
Loading…
x
Reference in New Issue
Block a user