File size: 946 Bytes
4223796
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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()