mirror of
https://github.com/myronblair/epic-download
synced 2026-06-30 17:51:00 -05:00
42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
import asyncio
|
|
from motor.motor_asyncio import AsyncIOMotorClient
|
|
from passlib.context import CryptContext
|
|
import os
|
|
from dotenv import load_dotenv
|
|
from pathlib import Path
|
|
|
|
# Load environment variables
|
|
ROOT_DIR = Path(__file__).parent
|
|
load_dotenv(ROOT_DIR / '.env')
|
|
|
|
# Password hashing
|
|
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
|
|
|
|
async def update_admin_password():
|
|
# Connect to MongoDB
|
|
mongo_url = os.environ['MONGO_URL']
|
|
client = AsyncIOMotorClient(mongo_url)
|
|
db = client[os.environ['DB_NAME']]
|
|
|
|
# New password
|
|
new_password = "Joker1974!!!"
|
|
new_password_hash = pwd_context.hash(new_password)
|
|
|
|
# Update admin password
|
|
result = await db.admin_users.update_one(
|
|
{"email": "admin@epictravel.com"},
|
|
{"$set": {"password_hash": new_password_hash}}
|
|
)
|
|
|
|
if result.modified_count > 0:
|
|
print(f"✓ Admin password updated successfully!")
|
|
print(f"✓ Email: admin@epictravel.com")
|
|
print(f"✓ New Password: {new_password}")
|
|
else:
|
|
print("✗ Failed to update password or admin user not found")
|
|
|
|
client.close()
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(update_admin_password())
|