Better logging.
This commit is contained in:
@@ -51,9 +51,13 @@ with app.app_context():
|
||||
db.session.commit()
|
||||
else:
|
||||
# Ensure admin privileges and sync password with Env Var (allows password reset via Docker)
|
||||
print(f"🔐 System: Syncing Admin User '{config.ADMIN_USER}' settings from environment.")
|
||||
if not admin.is_admin: admin.is_admin = True
|
||||
admin.password = generate_password_hash(config.ADMIN_PASSWORD, method='pbkdf2:sha256')
|
||||
db.session.add(admin)
|
||||
db.session.commit()
|
||||
elif not User.query.filter_by(is_admin=True).first():
|
||||
print("ℹ️ System: No Admin credentials found in environment variables. Admin account not created.")
|
||||
|
||||
# Migration: Add 'progress' column if missing
|
||||
try:
|
||||
@@ -115,6 +119,8 @@ def login():
|
||||
if not next_page or not is_safe_url(next_page):
|
||||
next_page = url_for('index')
|
||||
return redirect(next_page)
|
||||
if user and user.is_admin:
|
||||
print(f"⚠️ System: Admin login failed for '{username}'. Password hash mismatch.")
|
||||
flash('Invalid credentials')
|
||||
return render_template('login.html')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user