-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
31 lines (25 loc) · 971 Bytes
/
Copy pathapp.py
File metadata and controls
31 lines (25 loc) · 971 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from flask import Flask, render_template, request, redirect, url_for
app = Flask(__name__)
# Employee data (mock database)
employees = [
{"id": 1, "name": "John Doe", "position": "Manager", "status": "Active"},
{"id": 2, "name": "Jane Smith", "position": "Developer", "status": "On Leave"},
]
@app.route("/")
def index():
return render_template("index.html")
@app.route("/login", methods=["GET", "POST"])
def login():
if request.method == "POST":
username = request.form["username"]
password = request.form["password"]
# Mock authentication (replace with real authentication later)
if username == "admin" and password == "admin":
return redirect(url_for("dashboard"))
return "Invalid credentials"
return render_template("login.html")
@app.route("/dashboard")
def dashboard():
return render_template("dashboard.html", employees=employees)
if __name__ == "__main__":
app.run(debug=True)