diff --git a/src/app/page.tsx b/src/app/page.tsx
index 740799d..aea8f00 100644
--- a/src/app/page.tsx
+++ b/src/app/page.tsx
@@ -12,8 +12,67 @@ import FaqSplitText from '@/components/sections/faq/FaqSplitText';
import ContactFaq from '@/components/sections/contact/ContactFaq';
import FooterSimple from '@/components/sections/footer/FooterSimple';
import { Lock, BarChart3, CreditCard, Zap, Shield, Eye, History, FileText, Send, CheckCircle, TrendingUp, Calendar, ArrowRight } from 'lucide-react';
+import { useState } from 'react';
export default function LandingPage() {
+ const [loginEmail, setLoginEmail] = useState('');
+ const [loginPassword, setLoginPassword] = useState('');
+ const [loginError, setLoginError] = useState('');
+ const [loginSuccess, setLoginSuccess] = useState(false);
+
+ const handleLoginSubmit = async (e: React.FormEvent) => {
+ e.preventDefault();
+ setLoginError('');
+ setLoginSuccess(false);
+
+ // Client-side validation
+ if (!loginEmail || !loginPassword) {
+ setLoginError('Please enter both email and password.');
+ return;
+ }
+
+ if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(loginEmail)) {
+ setLoginError('Please enter a valid email address.');
+ return;
+ }
+
+ try {
+ // Send login request to secure backend endpoint
+ const response = await fetch('/api/auth/login', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ // CSRF token should be included for additional security
+ },
+ body: JSON.stringify({
+ email: loginEmail,
+ password: loginPassword,
+ }),
+ // Ensure credentials are sent securely over HTTPS only
+ credentials: 'include',
+ });
+
+ if (!response.ok) {
+ const errorData = await response.json();
+ setLoginError(errorData.message || 'Login failed. Please try again.');
+ return;
+ }
+
+ const data = await response.json();
+ setLoginSuccess(true);
+ setLoginEmail('');
+ setLoginPassword('');
+
+ // Redirect to dashboard after successful login
+ if (data.redirectUrl) {
+ window.location.href = data.redirectUrl;
+ }
+ } catch (error) {
+ setLoginError('An error occurred. Please try again.');
+ console.error('Login error:', error);
+ }
+ };
+
return (
+