diff --git a/game_collection/database.py b/game_collection/database.py index 8e24570..bc9a147 100644 --- a/game_collection/database.py +++ b/game_collection/database.py @@ -1,6 +1,7 @@ import sqlite3 import os from flask import current_app +from werkzeug.security import generate_password_hash def init_db(): db_path = os.path.join(current_app.instance_path, 'games.db') @@ -30,5 +31,12 @@ def init_db(): ) ''') + # Standardbenutzer erstellen + hashed_password = generate_password_hash("admin") + cursor.execute(''' + INSERT OR IGNORE INTO users (username, password, role) + VALUES (?, ?, ?) + ''', ("admin", hashed_password, "admin")) + conn.commit() conn.close()