Spaces:
Paused
Paused
| import sqlite3 | |
| from fastapi_users.password import PasswordHelper | |
| conn = sqlite3.connect('E:/crowdata/backend/crowdata.db') | |
| cursor = conn.cursor() | |
| # Hash new password | |
| helper = PasswordHelper() | |
| new_hash = helper.hash('admin123456') | |
| print(f'New hash for admin123456: {new_hash[:50]}...') | |
| # Update both admin users | |
| cursor.execute('UPDATE users SET hashed_password = ? WHERE email = "admin@crowdata.ar"', (new_hash,)) | |
| cursor.execute('UPDATE users SET hashed_password = ? WHERE email = "crowsistemas@proton.me"', (new_hash,)) | |
| conn.commit() | |
| print('Passwords updated to admin123456') | |
| # Verify | |
| cursor.execute('SELECT email, hashed_password FROM users WHERE email IN ("admin@crowdata.ar", "crowsistemas@proton.me")') | |
| for row in cursor.fetchall(): | |
| try: | |
| result = helper.verify_and_update('admin123456', row[1]) | |
| print(f'{row[0]} - admin123456: {result}') | |
| except Exception as e: | |
| print(f'{row[0]} - Error: {e}') | |
| conn.close() |