Logging in App.py
This commit is contained in:
+7
-4
@@ -34,12 +34,15 @@ def ist_konfiguriert():
|
||||
def versuche_verbindung_mit_warten():
|
||||
elapsed = 0
|
||||
if not ist_konfiguriert():
|
||||
logger.warning("⚠️ Noch keine Konfiguration gefunden.")
|
||||
return False
|
||||
config = lade_db_config()
|
||||
while not teste_verbindung(config) and elapsed < MAX_WAIT:
|
||||
print(f"[INFO] DB nicht erreichbar – warte {WAIT_INTERVAL}s...")
|
||||
logger.info(f"🔄 DB nicht erreichbar – warte {WAIT_INTERVAL}s...")
|
||||
time.sleep(WAIT_INTERVAL)
|
||||
elapsed += WAIT_INTERVAL
|
||||
if elapsed >= MAX_WAIT:
|
||||
logger.error("❌ Maximale Wartezeit überschritten – DB nicht erreichbar.")
|
||||
return elapsed < MAX_WAIT
|
||||
|
||||
@app.route('/api/status')
|
||||
@@ -63,10 +66,11 @@ def setup():
|
||||
}
|
||||
speichere_db_config(db_config)
|
||||
if teste_verbindung(db_config):
|
||||
initialisiere_admin_user(db_config) # <- das hier NEU
|
||||
initialisiere_admin_user(db_config)
|
||||
logger.info("✅ Setup erfolgreich, Admin-User erstellt.")
|
||||
return redirect('/')
|
||||
|
||||
else:
|
||||
logger.error("❌ Setup fehlgeschlagen – DB-Verbindung nicht möglich.")
|
||||
return "Verbindung fehlgeschlagen. Bitte zurück und prüfen.", 500
|
||||
return render_template('setup.html')
|
||||
|
||||
@@ -131,7 +135,6 @@ def login():
|
||||
|
||||
@app.route('/api/logout', methods=['POST'])
|
||||
def logout():
|
||||
# Aktuell macht das nichts, aber der Client bekommt Bestätigung
|
||||
return jsonify({"message": "Logout erfolgreich"})
|
||||
|
||||
def verify_token():
|
||||
|
||||
Reference in New Issue
Block a user