modified: app.py
This commit is contained in:
22
app.py
22
app.py
@@ -68,12 +68,6 @@ def get_db_connection():
|
||||
database=DB_NAME
|
||||
)
|
||||
|
||||
@app.route("/")
|
||||
def index():
|
||||
if "username" in session:
|
||||
return render_template("index.html", bot_running=bot_status(), theme=session.get('theme', 'light'))
|
||||
return redirect(url_for("login"))
|
||||
|
||||
@app.route("/login", methods=["GET", "POST"])
|
||||
def login():
|
||||
if request.method == "POST":
|
||||
@@ -129,18 +123,30 @@ def settings():
|
||||
return render_template("settings.html", introduction=introduction, asknotes_introduction=asknotes_introduction, theme=session.get('theme', 'light'))
|
||||
return redirect(url_for("login"))
|
||||
|
||||
@app.route("/")
|
||||
def index():
|
||||
if "username" in session:
|
||||
# Sicherstellen, dass das Theme gesetzt ist
|
||||
if 'theme' not in session:
|
||||
session['theme'] = 'light' # Standard-Theme setzen
|
||||
return render_template("index.html", bot_running=bot_status(), theme=session['theme'])
|
||||
return redirect(url_for("login"))
|
||||
|
||||
@app.route("/users")
|
||||
def users():
|
||||
"""Zeigt eine Liste aller Benutzer aus der Datenbank an."""
|
||||
if "username" in session:
|
||||
# Sicherstellen, dass das Theme gesetzt ist
|
||||
if 'theme' not in session:
|
||||
session['theme'] = 'light'
|
||||
|
||||
connection = get_db_connection()
|
||||
cursor = connection.cursor(dictionary=True)
|
||||
cursor.execute("SELECT * FROM user_data")
|
||||
users = cursor.fetchall()
|
||||
cursor.close()
|
||||
connection.close()
|
||||
return render_template("users.html", users=users)
|
||||
|
||||
return render_template("users.html", users=users, theme=session['theme'])
|
||||
return redirect(url_for("login"))
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user