Skip to content

Commit 10e35c9

Browse files
committed
Add debug endpoint to check users in database
1 parent 428fb58 commit 10e35c9

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

app.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,42 @@ def db_test():
909909
"database_path": db_path
910910
})
911911

912+
@app.route('/check-users')
913+
def check_users():
914+
"""Check if users exist in database - for debugging"""
915+
try:
916+
import sqlite3
917+
conn = sqlite3.connect(db_path)
918+
919+
# Check if user table exists
920+
cursor = conn.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='user'")
921+
if not cursor.fetchone():
922+
return jsonify({"status": "error", "message": "User table does not exist"})
923+
924+
# Get all users
925+
cursor = conn.execute("SELECT id, username, email, created_at FROM user")
926+
users = cursor.fetchall()
927+
928+
conn.close()
929+
930+
user_list = []
931+
for user in users:
932+
user_list.append({
933+
"id": user[0],
934+
"username": user[1],
935+
"email": user[2],
936+
"created_at": user[3]
937+
})
938+
939+
return jsonify({
940+
"status": "success",
941+
"user_count": len(user_list),
942+
"users": user_list
943+
})
944+
945+
except Exception as e:
946+
return jsonify({"status": "error", "message": str(e)})
947+
912948
@app.errorhandler(404)
913949
def not_found_error(error):
914950
return render_template('404.html'), 404

cookies.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Netscape HTTP Cookie File
2+
# https://curl.se/docs/http-cookies.html
3+
# This file was generated by libcurl! Edit at your own risk.
4+

0 commit comments

Comments
 (0)