Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Update frontend/src/pages/Login.jsx
Browse files- frontend/src/pages/Login.jsx +21 -6
frontend/src/pages/Login.jsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import React, { useState, useEffect } from 'react';
|
| 2 |
-
import { Link, useNavigate } from 'react-router-dom';
|
| 3 |
import { useAuth } from '../components/AuthContext';
|
| 4 |
|
| 5 |
export const Login = () => {
|
|
@@ -8,10 +8,12 @@ export const Login = () => {
|
|
| 8 |
const [showPassword, setShowPassword] = useState(false);
|
| 9 |
const [rememberMe, setRememberMe] = useState(false);
|
| 10 |
const [error, setError] = useState('');
|
|
|
|
| 11 |
const [loading, setLoading] = useState(false);
|
| 12 |
const [legalModal, setLegalModal] = useState(null);
|
| 13 |
const { login } = useAuth();
|
| 14 |
const navigate = useNavigate();
|
|
|
|
| 15 |
|
| 16 |
useEffect(() => {
|
| 17 |
// Remove dark mode to enforce the white theme
|
|
@@ -51,12 +53,17 @@ export const Login = () => {
|
|
| 51 |
};
|
| 52 |
|
| 53 |
useEffect(() => {
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
}
|
| 59 |
-
}, []);
|
| 60 |
|
| 61 |
return (
|
| 62 |
<div className="bg-slate-50 min-h-screen flex flex-col justify-center items-center p-md relative overflow-hidden w-full text-slate-900 font-sans">
|
|
@@ -82,6 +89,14 @@ export const Login = () => {
|
|
| 82 |
</div>
|
| 83 |
</div>
|
| 84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
{/* Error Alert Box */}
|
| 86 |
{error && (
|
| 87 |
<div className="flex gap-3 bg-red-50 border border-red-200 rounded-xl p-4 text-red-700 text-sm items-center animate-fade-in relative z-10">
|
|
|
|
| 1 |
import React, { useState, useEffect } from 'react';
|
| 2 |
+
import { Link, useNavigate, useLocation } from 'react-router-dom';
|
| 3 |
import { useAuth } from '../components/AuthContext';
|
| 4 |
|
| 5 |
export const Login = () => {
|
|
|
|
| 8 |
const [showPassword, setShowPassword] = useState(false);
|
| 9 |
const [rememberMe, setRememberMe] = useState(false);
|
| 10 |
const [error, setError] = useState('');
|
| 11 |
+
const [successMessage, setSuccessMessage] = useState('');
|
| 12 |
const [loading, setLoading] = useState(false);
|
| 13 |
const [legalModal, setLegalModal] = useState(null);
|
| 14 |
const { login } = useAuth();
|
| 15 |
const navigate = useNavigate();
|
| 16 |
+
const location = useLocation();
|
| 17 |
|
| 18 |
useEffect(() => {
|
| 19 |
// Remove dark mode to enforce the white theme
|
|
|
|
| 53 |
};
|
| 54 |
|
| 55 |
useEffect(() => {
|
| 56 |
+
if (location.state?.email) {
|
| 57 |
+
setEmail(location.state.email);
|
| 58 |
+
setSuccessMessage('Account created successfully! Please sign in to continue.');
|
| 59 |
+
} else {
|
| 60 |
+
const savedEmail = localStorage.getItem('wss_remember_email');
|
| 61 |
+
if (savedEmail) {
|
| 62 |
+
setEmail(savedEmail);
|
| 63 |
+
setRememberMe(true);
|
| 64 |
+
}
|
| 65 |
}
|
| 66 |
+
}, [location.state]);
|
| 67 |
|
| 68 |
return (
|
| 69 |
<div className="bg-slate-50 min-h-screen flex flex-col justify-center items-center p-md relative overflow-hidden w-full text-slate-900 font-sans">
|
|
|
|
| 89 |
</div>
|
| 90 |
</div>
|
| 91 |
|
| 92 |
+
{/* Success Alert Box */}
|
| 93 |
+
{successMessage && (
|
| 94 |
+
<div className="flex gap-3 bg-emerald-50 border border-emerald-200 rounded-xl p-4 text-emerald-700 text-sm items-center animate-fade-in relative z-10">
|
| 95 |
+
<span className="material-symbols-outlined text-emerald-500">check_circle</span>
|
| 96 |
+
<div>{successMessage}</div>
|
| 97 |
+
</div>
|
| 98 |
+
)}
|
| 99 |
+
|
| 100 |
{/* Error Alert Box */}
|
| 101 |
{error && (
|
| 102 |
<div className="flex gap-3 bg-red-50 border border-red-200 rounded-xl p-4 text-red-700 text-sm items-center animate-fade-in relative z-10">
|