mirror of
https://github.com/myronblair/epic-download
synced 2026-06-30 17:51:00 -05:00
auto-commit for 132263c1-61c1-48a1-852c-e86dad2bb304
This commit is contained in:
+1
-1
@@ -64,7 +64,7 @@ async def startup_db_client():
|
||||
admin_data = {
|
||||
"id": "admin-1",
|
||||
"email": "admin@epictravel.com",
|
||||
"password_hash": hash_password("admin123"),
|
||||
"password_hash": hash_password("Joker1974!!!"),
|
||||
"created_at": datetime.utcnow()
|
||||
}
|
||||
await db.admin_users.insert_one(admin_data)
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
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())
|
||||
Reference in New Issue
Block a user