From 4a6a99904a04c98c4518234a6911e598c8d97c79 Mon Sep 17 00:00:00 2001 From: moux1024 <403053463@qq.com> Date: Sat, 20 Sep 2025 18:02:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E5=92=8C=E6=B3=A8=E5=86=8C=E9=A1=B5=E5=B8=83?= =?UTF-8?q?=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/signup/page.tsx | 201 ++++++++----------------------- components/pages/login.tsx | 45 ++++--- components/pages/style/login.css | 4 +- lib/auth.ts | 3 - 4 files changed, 84 insertions(+), 169 deletions(-) diff --git a/app/signup/page.tsx b/app/signup/page.tsx index b154e1f..1dea14a 100644 --- a/app/signup/page.tsx +++ b/app/signup/page.tsx @@ -12,14 +12,11 @@ export default function SignupPage() { const [name, setName] = useState(""); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); - const [confirmPassword, setConfirmPassword] = useState(""); const [inviteCode, setInviteCode] = useState(""); const [isSubmitting, setIsSubmitting] = useState(false); const [formError, setFormError] = useState(""); const [passwordError, setPasswordError] = useState(""); - const [confirmPasswordError, setConfirmPasswordError] = useState(""); const [showPassword, setShowPassword] = useState(false); - const [showConfirmPassword, setShowConfirmPassword] = useState(false); const [agreeToTerms, setAgreeToTerms] = useState(true); const [showActivationModal, setShowActivationModal] = useState(false); const [resendCooldown, setResendCooldown] = useState(60); @@ -27,6 +24,8 @@ export default function SignupPage() { const [resendMessage, setResendMessage] = useState(""); const [resendError, setResendError] = useState(""); const [googleLoading, setGoogleLoading] = useState(false); + const [emailFocused, setEmailFocused] = useState(false); + const [passwordFocused, setPasswordFocused] = useState(false); const router = useRouter(); // Handle scroll indicator for small screens @@ -76,7 +75,7 @@ export default function SignupPage() { if (password.length > 18) { return "Password cannot exceed 18 characters"; } - if (!/^(?=.*[a-zA-Z])(?=.*\d)[a-zA-Z\d!@#$%^*&]{8,18}$/.test(password)) { + if (!/^(?=.*[a-zA-Z])(?=.*\d)[a-zA-Z\d!@#$%^*&\.]{8,18}$/.test(password)) { return "Password must contain both letters and numbers"; } return ""; @@ -149,34 +148,8 @@ export default function SignupPage() { } else { setPasswordError(""); } - - // 如果确认密码已输入,重新验证确认密码 - if (confirmPassword) { - if (newPassword !== confirmPassword) { - setConfirmPasswordError("Passwords do not match"); - } else { - setConfirmPasswordError(""); - } - } }; - /** 处理确认密码输入变化 */ - const handleConfirmPasswordChange = ( - e: React.ChangeEvent - ) => { - const newConfirmPassword = e.target.value; - setConfirmPassword(newConfirmPassword); - - if (newConfirmPassword) { - if (password !== newConfirmPassword) { - setConfirmPasswordError("Passwords do not match"); - } else { - setConfirmPasswordError(""); - } - } else { - setConfirmPasswordError(""); - } - }; const handleGoogleSignIn = async () => { try { @@ -201,12 +174,6 @@ export default function SignupPage() { return; } - // 验证确认密码 - if (password !== confirmPassword) { - setConfirmPasswordError("Passwords do not match"); - return; - } - // 验证是否同意条款 if (!agreeToTerms) { setFormError("Please agree to the Terms of Service and Privacy Policy"); @@ -219,7 +186,6 @@ export default function SignupPage() { try { // Use new registration API const response = await registerUserWithInvite({ - name: name, email, password, invite_code: inviteCode || undefined, @@ -430,51 +396,54 @@ export default function SignupPage() {

Sign Up, for free

-

Create your account to get started

+

Start Turning Your Ideas Into Stunning Videos

{/* Scrollable Middle Content */} -
-
-
-
diff --git a/components/pages/login.tsx b/components/pages/login.tsx index fc8738f..17b7744 100644 --- a/components/pages/login.tsx +++ b/components/pages/login.tsx @@ -19,6 +19,8 @@ export default function Login() { const [successMessage, setSuccessMessage] = useState(""); const [passwordError, setPasswordError] = useState(""); const [googleLoading, setGoogleLoading] = useState(false); + const [emailFocused, setEmailFocused] = useState(false); + const [passwordFocused, setPasswordFocused] = useState(false); const router = useRouter(); const searchParams = useSearchParams(); @@ -35,7 +37,7 @@ export default function Login() { if (password.length > 18) { return "Password cannot exceed 18 characters"; } - if (!/^(?=.*[a-zA-Z])(?=.*\d)[a-zA-Z\d!@#$%^*&]{8,18}$/.test(password)) { + if (!/^(?=.*[a-zA-Z])(?=.*\d)[a-zA-Z\d!@#$%^*&\.]{8,18}$/.test(password)) { return "Password must contain both letters and numbers"; } return ""; @@ -169,9 +171,7 @@ export default function Login() {

Login

-

- Enter your information to access your account -

+

Your inspiration is waiting.
Log in to bring your vision to life.

@@ -181,22 +181,40 @@ export default function Login() {
)} -
- +
+ setEmail(e.target.value)} + onFocus={() => setEmailFocused(true)} + onBlur={() => setEmailFocused(false)} />
-
+ setPasswordFocused(true)} + onBlur={() => setPasswordFocused(false)} />
{passwordError && ( -

{passwordError}

- )} - {password && !passwordError && ( -

✓ Password format is correct

+

{passwordError}

)} {/*
@@ -233,7 +250,7 @@ export default function Login() {
{formError && ( -
+
{formError}
)} diff --git a/components/pages/style/login.css b/components/pages/style/login.css index 2d93544..e8d31e3 100644 --- a/components/pages/style/login.css +++ b/components/pages/style/login.css @@ -121,9 +121,9 @@ .form-control:focus { outline: none; - border-color: rgba(255, 255, 255, 0.3); + border-color: #6AF4F9; background: rgba(255, 255, 255, 0.1); - box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.05); + box-shadow: 0 0 0 2px rgba(106, 244, 249, 0.2); } .form-control::placeholder { diff --git a/lib/auth.ts b/lib/auth.ts index efa3093..e149fb1 100644 --- a/lib/auth.ts +++ b/lib/auth.ts @@ -616,12 +616,10 @@ export const registerUser = async ({ }; export const registerUserWithInvite = async ({ - name, password, email, invite_code, }: { - name: string; password: string; email: string; invite_code?: string; @@ -634,7 +632,6 @@ export const registerUserWithInvite = async ({ 'Content-Type': 'application/json', }, body: JSON.stringify({ - name, password, email, invite_code,