2026.03.29 20:00 Gitea_manager javítás előtt
This commit is contained in:
62
reset_test_user_password.py
Normal file
62
reset_test_user_password.py
Normal file
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Reset password for tester_pro@profibot.hu to 'test123'
|
||||
"""
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, '/app/backend')
|
||||
|
||||
from app.core.security import get_password_hash
|
||||
from sqlalchemy import create_engine, text
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
|
||||
# Database URL from environment
|
||||
DATABASE_URL = "postgresql+psycopg2://service_finder_app:JELSZAVAD@shared-postgres:5432/service_finder"
|
||||
|
||||
def reset_password():
|
||||
"""Reset password for tester_pro@profibot.hu"""
|
||||
engine = create_engine(DATABASE_URL)
|
||||
Session = sessionmaker(bind=engine)
|
||||
session = Session()
|
||||
|
||||
try:
|
||||
# Get password hash for 'test123'
|
||||
password_hash = get_password_hash("test123")
|
||||
print(f"Password hash for 'test123': {password_hash}")
|
||||
|
||||
# Update the user
|
||||
update_stmt = text("""
|
||||
UPDATE identity.users
|
||||
SET hashed_password = :password_hash
|
||||
WHERE email = :email
|
||||
""")
|
||||
|
||||
result = session.execute(
|
||||
update_stmt,
|
||||
{"password_hash": password_hash, "email": "tester_pro@profibot.hu"}
|
||||
)
|
||||
|
||||
session.commit()
|
||||
|
||||
if result.rowcount > 0:
|
||||
print(f"Successfully updated password for tester_pro@profibot.hu")
|
||||
return True
|
||||
else:
|
||||
print(f"User not found: tester_pro@profibot.hu")
|
||||
return False
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
session.rollback()
|
||||
return False
|
||||
finally:
|
||||
session.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("Resetting password for tester_pro@profibot.hu...")
|
||||
if reset_password():
|
||||
print("Password reset successful")
|
||||
sys.exit(0)
|
||||
else:
|
||||
print("Password reset failed")
|
||||
sys.exit(1)
|
||||
Reference in New Issue
Block a user