Spaces:
Running

File size: 990 Bytes
506bd65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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())