Spaces:
Running

microfunnel-api / backend /reset_password.py
axeronis
fix: Notification UI icons and Admin password reset
506bd65
Raw History Blame Contribute Delete
990 Bytes
import asyncio
from sqlmodel import select
from app.core.database import async_session_maker
from app.models.user import User
TARGET_EMAIL = "axeroni.s2@gmail.com"
NEW_PASSWORD = "ChangeMe123!"
async def reset_password():
print(f"πŸ”„ Resetting password for {TARGET_EMAIL}...")
async with async_session_maker() as session:
try:
result = await session.execute(select(User).where(User.email == TARGET_EMAIL))
user = result.scalar_one_or_none()
if user:
hashed = User.get_password_hash(NEW_PASSWORD)
user.hashed_password = hashed
session.add(user)
await session.commit()
print(f"βœ… Password succesfully reset to: {NEW_PASSWORD}")
else:
print("❌ User not found!")
except Exception as e:
print(f"❌ Error: {e}")
if __name__ == "__main__":
asyncio.run(reset_password())