#!/usr/bin/env python3 """Reset Ronny's password to 'admin123'""" import sys sys.path.insert(0, '/home/OfficeDesk/backend') from passlib.context import CryptContext import psycopg2 pwd_context = CryptContext(schemes=["argon2"], deprecated="auto") def main(): # Hash the new password new_password = "admin123" hashed = pwd_context.hash(new_password) # Connect to database conn = psycopg2.connect('postgresql://postgres:your_password@192.168.0.19/OfficeDesk') cur = conn.cursor() # Check current user cur.execute('SELECT id, username, email FROM "user" WHERE id = 1') user = cur.fetchone() if not user: print("❌ User Ronny (id=1) not found") conn.close() return print(f"Found user: {user[1]} (ID: {user[0]}, Email: {user[2]})") # Update password cur.execute('UPDATE "user" SET hashed_password = %s WHERE id = 1', (hashed,)) conn.commit() print(f"✅ Password reset successful!") print(f" Username: {user[1]}") print(f" New password: {new_password}") cur.close() conn.close() if __name__ == "__main__": main()