final update

This commit is contained in:
2025-06-29 17:04:23 +03:00
parent 68cc47882c
commit da57e066ae
5 changed files with 78 additions and 20 deletions

18
app.py
View File

@@ -622,6 +622,22 @@ def debug_content_positions(group_id):
return jsonify(content_data)
@app.cli.command("create-admin")
@click.option("--username", default="admin", help="Admin username")
@click.option("--password", help="Admin password")
def create_admin(username, password):
"""Create an admin user."""
from models import User
from extensions import bcrypt
hashed_password = bcrypt.generate_password_hash(password).decode('utf-8')
user = User(username=username, password=hashed_password, role='admin')
db.session.add(user)
db.session.commit()
print(f"Admin user '{username}' created successfully.")
# Add this at the end of app.py
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0', port=5000)
app.run(debug=True, host='0.0.0.0', port=5000)