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 React, { useState } from "react";
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from "next/navigation";
|
||||||
import Link from 'next/link';
|
import Link from "next/link";
|
||||||
import { signInWithGoogle, registerUser } from '@/lib/auth';
|
import { signInWithGoogle, registerUser } from "@/lib/auth";
|
||||||
import { GradientText } from '@/components/ui/gradient-text';
|
import { GradientText } from "@/components/ui/gradient-text";
|
||||||
|
|
||||||
export default function SignupPage() {
|
export default function SignupPage() {
|
||||||
const [name, setName] = useState('');
|
const [name, setName] = useState("");
|
||||||
const [email, setEmail] = useState('');
|
const [email, setEmail] = useState("");
|
||||||
const [password, setPassword] = useState('');
|
const [password, setPassword] = useState("");
|
||||||
const [inviteCode, setInviteCode] = useState('');
|
const [inviteCode, setInviteCode] = useState("");
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||||
const [formError, setFormError] = useState('');
|
const [formError, setFormError] = useState("");
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
|
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setIsSubmitting(true);
|
setIsSubmitting(true);
|
||||||
setFormError('');
|
setFormError("");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Use new registration API
|
// Use new registration API
|
||||||
@ -30,10 +30,10 @@ export default function SignupPage() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Redirect to login page after successful registration
|
// Redirect to login page after successful registration
|
||||||
router.push('/login?registered=true');
|
router.push("/login?registered=true");
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.error('Signup error:', error);
|
console.error("Signup error:", error);
|
||||||
setFormError('Registration failed, please try again');
|
setFormError("Registration failed, please try again");
|
||||||
} finally {
|
} finally {
|
||||||
setIsSubmitting(false);
|
setIsSubmitting(false);
|
||||||
}
|
}
|
||||||
@ -58,10 +58,17 @@ export default function SignupPage() {
|
|||||||
</video>
|
</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 */}
|
{/* 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">
|
<span className="logo-heart">
|
||||||
<GradientText
|
<GradientText
|
||||||
text="MovieFlow"
|
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="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="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">
|
<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>
|
<p className="text-gray-300">Create your account to get started</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form onSubmit={handleSubmit} className="space-y-4">
|
<form onSubmit={handleSubmit} className="space-y-4">
|
||||||
<div>
|
<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
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Your name"
|
placeholder="Your name"
|
||||||
@ -97,7 +108,9 @@ export default function SignupPage() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<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
|
<input
|
||||||
type="email"
|
type="email"
|
||||||
placeholder="your@email.com"
|
placeholder="your@email.com"
|
||||||
@ -109,7 +122,9 @@ export default function SignupPage() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<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
|
<input
|
||||||
type="password"
|
type="password"
|
||||||
placeholder="Password"
|
placeholder="Password"
|
||||||
@ -121,7 +136,9 @@ export default function SignupPage() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<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
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Enter invite code if you have one"
|
placeholder="Enter invite code if you have one"
|
||||||
@ -149,7 +166,7 @@ export default function SignupPage() {
|
|||||||
disabled={isSubmitting}
|
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"
|
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>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@ -170,7 +187,13 @@ export default function SignupPage() {
|
|||||||
|
|
||||||
<div className="text-center mt-4">
|
<div className="text-center mt-4">
|
||||||
<p style={{ color: "rgba(255, 255, 255, 0.6)" }}>
|
<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>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,37 +1,39 @@
|
|||||||
'use client';
|
"use client";
|
||||||
|
|
||||||
import { useState, useCallback, useEffect } from 'react';
|
import { useState, useCallback, useEffect } from "react";
|
||||||
import './style/login.css';
|
import "./style/login.css";
|
||||||
import { useRouter, useSearchParams } from 'next/navigation';
|
import { useRouter, useSearchParams } from "next/navigation";
|
||||||
import React from 'react';
|
import React from "react";
|
||||||
import Link from 'next/link';
|
import Link from "next/link";
|
||||||
import { signInWithGoogle, loginUser } from '@/lib/auth';
|
import { signInWithGoogle, loginUser } from "@/lib/auth";
|
||||||
import { GradientText } from '@/components/ui/gradient-text';
|
import { GradientText } from "@/components/ui/gradient-text";
|
||||||
import { Eye, EyeOff } from 'lucide-react';
|
import { Eye, EyeOff } from "lucide-react";
|
||||||
|
|
||||||
export default function Login() {
|
export default function Login() {
|
||||||
const [email, setEmail] = useState('');
|
const [email, setEmail] = useState("");
|
||||||
const [password, setPassword] = useState('');
|
const [password, setPassword] = useState("");
|
||||||
const [showPassword, setShowPassword] = useState(false);
|
const [showPassword, setShowPassword] = useState(false);
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||||
const [formError, setFormError] = useState('');
|
const [formError, setFormError] = useState("");
|
||||||
const [successMessage, setSuccessMessage] = useState('');
|
const [successMessage, setSuccessMessage] = useState("");
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
|
|
||||||
// Check for registered=true parameter
|
// Check for registered=true parameter
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const registered = searchParams?.get('registered');
|
const registered = searchParams?.get("registered");
|
||||||
if (registered === 'true') {
|
if (registered === "true") {
|
||||||
setSuccessMessage('Registration successful! Please login with your new account.');
|
setSuccessMessage(
|
||||||
|
"Registration successful! Please login with your new account."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const error = searchParams?.get('error');
|
const error = searchParams?.get("error");
|
||||||
if (error) {
|
if (error) {
|
||||||
if (error === 'google_oauth') {
|
if (error === "google_oauth") {
|
||||||
setFormError('Google login failed, please try again.');
|
setFormError("Google login failed, please try again.");
|
||||||
} else if (error === 'auth_failed') {
|
} else if (error === "auth_failed") {
|
||||||
setFormError('Authentication failed, please try again.');
|
setFormError("Authentication failed, please try again.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [searchParams]);
|
}, [searchParams]);
|
||||||
@ -43,18 +45,20 @@ export default function Login() {
|
|||||||
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
|
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setIsSubmitting(true);
|
setIsSubmitting(true);
|
||||||
setFormError('');
|
setFormError("");
|
||||||
setSuccessMessage('');
|
setSuccessMessage("");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await loginUser(email, password);
|
await loginUser(email, password);
|
||||||
// 登录成功后跳转到首页
|
// 登录成功后跳转到首页
|
||||||
router.push('/');
|
router.push("/");
|
||||||
} catch (error: any) {
|
} 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 {
|
} finally {
|
||||||
setIsSubmitting(false);
|
setIsSubmitting(false);
|
||||||
}
|
}
|
||||||
@ -76,10 +80,17 @@ export default function Login() {
|
|||||||
</video>
|
</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 */}
|
{/* 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">
|
<span className="logo-heart">
|
||||||
<GradientText
|
<GradientText
|
||||||
text="MovieFlow"
|
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-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">
|
<div className="auth-header text-center mb-6">
|
||||||
<h2 className="text-2xl font-bold text-white pb-4">Login</h2>
|
<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>
|
</div>
|
||||||
|
|
||||||
<form onSubmit={handleSubmit}>
|
<form onSubmit={handleSubmit}>
|
||||||
@ -140,7 +153,13 @@ export default function Login() {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex justify-end mt-2">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -155,7 +174,7 @@ export default function Login() {
|
|||||||
className="w-full mt-4 btn btn-primary"
|
className="w-full mt-4 btn btn-primary"
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
>
|
>
|
||||||
{isSubmitting ? 'Logging in...' : 'Login'}
|
{isSubmitting ? "Logging in..." : "Login"}
|
||||||
</button>
|
</button>
|
||||||
{/*
|
{/*
|
||||||
<div className="my-4 relative flex items-center">
|
<div className="my-4 relative flex items-center">
|
||||||
@ -175,7 +194,10 @@ export default function Login() {
|
|||||||
|
|
||||||
<div className="text-center mt-4">
|
<div className="text-center mt-4">
|
||||||
<p style={{ color: "rgba(255, 255, 255, 0.6)" }}>
|
<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>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@ -47,6 +47,11 @@ const nextConfig = {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 确保静态文件可以正常访问
|
||||||
|
experimental: {
|
||||||
|
staticPageGenerationTimeout: 120,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = nextConfig;
|
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