Skip to content

Commit 32a833e

Browse files
author
Uttam Singh
committed
Add login page and authentication
1 parent 2ac1b47 commit 32a833e

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed

frontend/src/pages/App.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export default function App(){
1919
<div className="container">
2020
<Routes>
2121
<Route path="/" element={<Dashboard />} />
22+
<Route path="/login" element={<Login />} />
2223
<Route path="/tasks" element={<Tasks />} />
2324
<Route path="/ai" element={<AIChat />} />
2425
</Routes>

frontend/src/pages/login.jsx

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import React, { useState } from "react";
2+
import { useNavigate } from "react-router-dom";
3+
4+
export default function Login() {
5+
const navigate = useNavigate();
6+
const [email, setEmail] = useState("");
7+
const [password, setPassword] = useState("");
8+
9+
const handleLogin = (e) => {
10+
e.preventDefault();
11+
12+
// Replace these with your admin credentials
13+
if (email === "[email protected]" && password === "123") {
14+
localStorage.setItem("user", email);
15+
navigate("/");
16+
} else {
17+
alert("Invalid credentials");
18+
}
19+
};
20+
21+
return (
22+
<div
23+
style={{
24+
display: "flex",
25+
alignItems: "center",
26+
justifyContent: "center",
27+
height: "100vh",
28+
flexDirection: "column",
29+
background: "linear-gradient(to right, #f7faff, #eaf2ff)",
30+
}}
31+
>
32+
<img src="/logo.png" alt="logo" style={{ height: 70, marginBottom: 20 }} />
33+
<h2 style={{ color: "#004aad" }}>Welcome to FAT-EIBL</h2>
34+
<p style={{ marginBottom: 20, color: "#555" }}>
35+
Finance Audit Tracker – Edme Insurance Brokers Limited
36+
</p>
37+
<form
38+
onSubmit={handleLogin}
39+
style={{
40+
background: "#fff",
41+
padding: 30,
42+
borderRadius: 10,
43+
boxShadow: "0 2px 10px rgba(0,0,0,0.1)",
44+
display: "flex",
45+
flexDirection: "column",
46+
gap: 10,
47+
minWidth: 300,
48+
}}
49+
>
50+
<input
51+
type="email"
52+
placeholder="Email"
53+
value={email}
54+
onChange={(e) => setEmail(e.target.value)}
55+
required
56+
style={{ padding: 10, borderRadius: 6, border: "1px solid #ccc" }}
57+
/>
58+
<input
59+
type="password"
60+
placeholder="Password"
61+
value={password}
62+
onChange={(e) => setPassword(e.target.value)}
63+
required
64+
style={{ padding: 10, borderRadius: 6, border: "1px solid #ccc" }}
65+
/>
66+
<button className="btn" type="submit">
67+
Login
68+
</button>
69+
</form>
70+
</div>
71+
);
72+
}

0 commit comments

Comments
 (0)