collabrix/scripts/reset_ronny_password.py
DGSoft 93b98cfb5c Initial commit: Team Chat System with Code Snippet Library
- Complete chat application similar to Microsoft Teams
- Code snippet library with syntax highlighting
- Real-time messaging with WebSockets
- File upload with Office integration
- Department-based permissions
- Dark/Light theme support
- Production deployment with SSL/Reverse Proxy
- Docker containerization
- PostgreSQL database with SQLModel ORM
2025-12-09 22:25:03 +01:00

43 lines
1.1 KiB
Python

#!/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()