import { useState, useEffect } from 'react'; import { Link, useNavigate, useLocation } from 'react-router-dom'; import { useAuth } from '../components/AuthContext'; export const Login = () => { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [showPassword, setShowPassword] = useState(false); const [rememberMe, setRememberMe] = useState(false); const [error, setError] = useState(''); const [successMessage, setSuccessMessage] = useState(''); const [loading, setLoading] = useState(false); const [legalModal, setLegalModal] = useState(null); const { login } = useAuth(); const navigate = useNavigate(); const location = useLocation(); useEffect(() => { // Remove dark mode to enforce the white theme document.documentElement.classList.remove('dark'); }, []); const handleSubmit = async (e) => { e.preventDefault(); setError(''); setLoading(true); try { const res = await fetch('/api/auth/login', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ email, password }) }); const data = await res.json(); if (res.ok) { login(data.access_token || data.token, data.refresh_token, data.user); if (rememberMe) { localStorage.setItem('wss_remember_email', email); } else { localStorage.removeItem('wss_remember_email'); } navigate('/dashboard'); } else { setError(data.message || 'Authentication failed. Please verify credentials.'); } } catch (err) { setError('Could not establish connection to the security server API.'); console.error(err); } finally { setLoading(false); } }; useEffect(() => { if (location.state?.email) { setEmail(location.state.email); setSuccessMessage('Account created successfully! Please sign in to continue.'); } else { const savedEmail = localStorage.getItem('wss_remember_email'); if (savedEmail) { setEmail(savedEmail); setRememberMe(true); } } }, [location.state]); return (
{/* Background Gradients & Floating Elements for Light Mode */}
{/* Auth Container */}
{/* Header / Branding */}
LarShield Logo

Welcome Back

Sign in to access your security console.

{/* Success Alert Box */} {successMessage && (
check_circle
{successMessage}
)} {/* Error Alert Box */} {error && (
warning
{error}
)} {/* Login Form */}
mail
setEmail(e.target.value)} />
Forgot password?
lock
setPassword(e.target.value)} />
{/* Password Validation Checklist - Only shown when typing password */} {password.length > 0 && (
= 8 ? 'text-emerald-600 font-semibold' : 'text-slate-500'}`}> {password.length >= 8 ? 'check_circle' : 'radio_button_unchecked'} At least 8 characters
{/[A-Z]/.test(password) ? 'check_circle' : 'radio_button_unchecked'} One uppercase letter
{/[a-z]/.test(password) ? 'check_circle' : 'radio_button_unchecked'} One lowercase letter
{/[^A-Za-z0-9]/.test(password) ? 'check_circle' : 'radio_button_unchecked'} One special character
)}
setRememberMe(e.target.checked)} /> check

By signing in, you agree to our{' '} {' '} and{' '} .

Don't have an account?{' '} Create an account

{/* Legal Policies Modal */} {legalModal && (
setLegalModal(null)} />
{/* Header */}
gavel

Legal Policies

{/* Modal Body */}
{legalModal === 'terms' && (

Terms of Service

Effective Date: August 15, 2026

1. Acceptance of Terms

By accessing or using the Larshield platform (the "Service"), you agree to be bound by these Terms of Service. If you do not agree, you may not access the Service.

2. Description of Service

Larshield provides automated vulnerability scanning, active penetration testing, and security posture management tools. The Service actively probes designated targets to identify security flaws, misconfigurations, and compliance violations.

3. Authorization and Legal Use

You explicitly certify that you possess full, legally verifiable authorization from the system owner to conduct active security assessments against any target URL you submit. Unauthorized scanning is illegal and strictly prohibited. You assume all liability for damages resulting from unauthorized use of the Service.

4. Limitation of Liability

Larshield is provided "AS IS". Vulnerability scanning can cause unintended disruptions, including data loss or system crashes. To the maximum extent permitted by law, Larshield shall not be liable for any direct, indirect, incidental, special, or consequential damages resulting from the use or inability to use the Service.

5. Termination

We reserve the right to suspend or terminate your account immediately, without prior notice or liability, for any reason, including without limitation if you breach the Terms, particularly regarding unauthorized target scanning.

)} {legalModal === 'aup' && (

Acceptable Use Policy (Rules of Engagement)

Effective Date: August 15, 2026

This Acceptable Use Policy (AUP) sets the rules of engagement for utilizing the Larshield platform. Violating this policy will result in immediate account termination and potential legal referral.

1. Prohibited Activities

  • Unauthorized Scanning: Scanning infrastructure, applications, or networks that you do not own or lack explicit, documented consent to test.
  • Denial of Service (DoS/DDoS): Utilizing Larshield's infrastructure to intentionally flood, exhaust, or deny access to a target system.
  • Destructive Payloads: Modifying, deleting, or exfiltrating data from a target system beyond what is strictly necessary to demonstrate a proof-of-concept for a vulnerability.
  • Government & Healthcare Infrastructure: You may not scan government, military, emergency services, or critical healthcare infrastructure without verifying compliance with local regulations.

2. Abuse Prevention and Monitoring

Larshield implements automated heuristics to detect abuse. We reserve the right to instantly halt any active scan that triggers abuse thresholds, resembles a DoS attack, or targets known blacklisted domains.

)} {legalModal === 'privacy' && (

Privacy Policy

Effective Date: August 15, 2026

This Privacy Policy describes how Larshield ("we", "us", or "our") collects, uses, and shares your personal information. We are committed to complying with global data protection laws including the GDPR, CCPA, and India's DPDP Act.

1. Information We Collect

Account Data: Email address, name, billing information, and organization details.

Scan Data: Target URLs, scan configurations, identified vulnerabilities, and generated PDF reports.

Audit Logs: Origin IP addresses, access timestamps, and API request logs for security and compliance monitoring.

2. How We Use Your Information

We use your data strictly to provide, maintain, and improve the Service, process payments, and ensure legal compliance. We do not sell your personal data or scan results to third parties.

3. Data Security

Scan results and user data are encrypted at rest (AES-256) and in transit (TLS 1.3). We enforce strict role-based access controls internally. However, no internet transmission is entirely secure, and you use the Service at your own risk.

4. Your Rights (GDPR & CCPA)

Depending on your jurisdiction, you have the right to access, correct, delete, or restrict the processing of your personal data. You can request a complete data export or account deletion by contacting info@larxius.com.

)}
{/* Footer */}
)}
); };