mirror of
https://github.com/myronblair/epic-download
synced 2026-06-30 17:51:00 -05:00
auto-commit for 8ed86e4d-a0e9-4c5c-b2b5-313c1bc955e5
This commit is contained in:
+3
-1
@@ -1,3 +1,5 @@
|
|||||||
MONGO_URL="mongodb://localhost:27017"
|
MONGO_URL="mongodb://localhost:27017"
|
||||||
DB_NAME="test_database"
|
DB_NAME="test_database"
|
||||||
CORS_ORIGINS="*"
|
CORS_ORIGINS="*"
|
||||||
|
JWT_SECRET_KEY="8f3a9c2e1d7b4f6a5c8e2d9a7b3f5c1e4a6d8b2c9e5f7a3d1c4b6e8a2f5d7c9b"
|
||||||
|
ADMIN_DEFAULT_PASSWORD="Joker1974!!!"
|
||||||
+7
-1
@@ -5,9 +5,15 @@ from passlib.context import CryptContext
|
|||||||
from fastapi import HTTPException, Security, Depends
|
from fastapi import HTTPException, Security, Depends
|
||||||
from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials
|
from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials
|
||||||
import os
|
import os
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
# Load environment variables
|
||||||
|
ROOT_DIR = Path(__file__).parent
|
||||||
|
load_dotenv(ROOT_DIR / '.env')
|
||||||
|
|
||||||
# JWT Configuration
|
# JWT Configuration
|
||||||
SECRET_KEY = os.environ.get("JWT_SECRET_KEY", "your-secret-key-change-in-production-epic-travel-2025")
|
SECRET_KEY = os.environ['JWT_SECRET_KEY']
|
||||||
ALGORITHM = "HS256"
|
ALGORITHM = "HS256"
|
||||||
ACCESS_TOKEN_EXPIRE_MINUTES = 1440 # 24 hours
|
ACCESS_TOKEN_EXPIRE_MINUTES = 1440 # 24 hours
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ async def get_destinations(category: Optional[str] = None, search: Optional[str]
|
|||||||
{"location": {"$regex": search, "$options": "i"}}
|
{"location": {"$regex": search, "$options": "i"}}
|
||||||
]
|
]
|
||||||
|
|
||||||
destinations = await db.destinations.find(query).to_list(1000)
|
destinations = await db.destinations.find(query, {'_id': 0}).limit(100).to_list(100)
|
||||||
|
|
||||||
# Convert MongoDB _id to id for response
|
# Convert MongoDB _id to id for response
|
||||||
for dest in destinations:
|
for dest in destinations:
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ def set_db(database):
|
|||||||
@router.get("", response_model=List[Special])
|
@router.get("", response_model=List[Special])
|
||||||
async def get_specials():
|
async def get_specials():
|
||||||
"""Get all weekly specials"""
|
"""Get all weekly specials"""
|
||||||
specials = await db.specials.find().to_list(1000)
|
specials = await db.specials.find({}, {'_id': 0}).limit(100).to_list(100)
|
||||||
|
|
||||||
# Convert MongoDB _id to id for response
|
# Convert MongoDB _id to id for response
|
||||||
for special in specials:
|
for special in specials:
|
||||||
|
|||||||
+1
-1
@@ -64,7 +64,7 @@ async def startup_db_client():
|
|||||||
admin_data = {
|
admin_data = {
|
||||||
"id": "admin-1",
|
"id": "admin-1",
|
||||||
"email": "admin@epictravel.com",
|
"email": "admin@epictravel.com",
|
||||||
"password_hash": hash_password("Joker1974!!!"),
|
"password_hash": hash_password(os.environ['ADMIN_DEFAULT_PASSWORD']),
|
||||||
"created_at": datetime.utcnow()
|
"created_at": datetime.utcnow()
|
||||||
}
|
}
|
||||||
await db.admin_users.insert_one(admin_data)
|
await db.admin_users.insert_one(admin_data)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ const AdminLogin = () => {
|
|||||||
navigate('/admin/dashboard');
|
navigate('/admin/dashboard');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Login error:', error);
|
console.error('Login error:', error);
|
||||||
toast.error('Invalid credentials. Try: admin@epictravel.com / admin123');
|
toast.error('Invalid email or password. Please try again.');
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user