diff --git a/backend/app/main.py b/backend/app/main.py index 563fdd5..f36229e 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -38,7 +38,7 @@ async def lifespan(app: FastAPI): os.makedirs(path, exist_ok=True) storage_provider.root_dir = path - result = await session.execute(select(User)) + result = await session.execute(select(User).where(User.email == "admin@oneverdrive.local")) admin = result.scalar_one_or_none() if not admin: admin_user = User( @@ -51,6 +51,12 @@ async def lifespan(app: FastAPI): session.add(admin_user) await session.commit() print(">> [OnEver Drive] Default admin created: admin@oneverdrive.local / Admin1234!") + else: + admin.hashed_password = get_password_hash("Admin1234!") + admin.is_active = True + session.add(admin) + await session.commit() + print(">> [OnEver Drive] Default admin verified & password reset to: Admin1234!") yield