Refactor authentication services to async password handling; optimize bulk operations and queries
- Updated `verify_password` and `get_password_hash` to their async counterparts to prevent event loop blocking. - Replaced N+1 query patterns in `admin.py` and `session_async.py` with optimized bulk operations for improved performance. - Enhanced `user_async.py` with bulk update and soft delete methods for efficient user management. - Added eager loading support in CRUD operations to prevent N+1 query issues. - Updated test cases with stronger password examples for better security representation.
This commit is contained in:
@@ -131,7 +131,7 @@ def test_user(test_db):
|
||||
user = User(
|
||||
id=uuid.uuid4(),
|
||||
email="testuser@example.com",
|
||||
password_hash=get_password_hash("TestPassword123"),
|
||||
password_hash=get_password_hash("TestPassword123!"),
|
||||
first_name="Test",
|
||||
last_name="User",
|
||||
phone_number="+1234567890",
|
||||
@@ -155,7 +155,7 @@ def test_superuser(test_db):
|
||||
user = User(
|
||||
id=uuid.uuid4(),
|
||||
email="superuser@example.com",
|
||||
password_hash=get_password_hash("SuperPassword123"),
|
||||
password_hash=get_password_hash("SuperPassword123!"),
|
||||
first_name="Super",
|
||||
last_name="User",
|
||||
phone_number="+9876543210",
|
||||
@@ -181,7 +181,7 @@ async def async_test_user(async_test_db):
|
||||
user = User(
|
||||
id=uuid.uuid4(),
|
||||
email="testuser@example.com",
|
||||
password_hash=get_password_hash("TestPassword123"),
|
||||
password_hash=get_password_hash("TestPassword123!"),
|
||||
first_name="Test",
|
||||
last_name="User",
|
||||
phone_number="+1234567890",
|
||||
@@ -207,7 +207,7 @@ async def async_test_superuser(async_test_db):
|
||||
user = User(
|
||||
id=uuid.uuid4(),
|
||||
email="superuser@example.com",
|
||||
password_hash=get_password_hash("SuperPassword123"),
|
||||
password_hash=get_password_hash("SuperPassword123!"),
|
||||
first_name="Super",
|
||||
last_name="User",
|
||||
phone_number="+9876543210",
|
||||
|
||||
Reference in New Issue
Block a user