mirror of
https://github.com/fastapi-users/fastapi-users.git
synced 2025-08-15 19:30:47 +08:00
* Improve test coverage of BaseUserDatabase * Improve unit test isolation * Improve coverage of router and authentication
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import inspect
|
||||
import asyncio
|
||||
from typing import Any, Callable, Type
|
||||
|
||||
import jwt
|
||||
@ -28,7 +28,7 @@ def get_user_router(
|
||||
models = Models(user_model)
|
||||
|
||||
reset_password_token_audience = "fastapi-users:reset"
|
||||
is_on_after_forgot_password_async = inspect.iscoroutinefunction(
|
||||
is_on_after_forgot_password_async = asyncio.iscoroutinefunction(
|
||||
on_after_forgot_password
|
||||
)
|
||||
|
||||
@ -87,9 +87,8 @@ def get_user_router(
|
||||
if user is None or not user.is_active:
|
||||
raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
updated_user = BaseUserDB(**user.dict())
|
||||
updated_user.hashed_password = get_password_hash(password)
|
||||
await user_db.update(updated_user)
|
||||
user.hashed_password = get_password_hash(password)
|
||||
await user_db.update(user)
|
||||
except jwt.PyJWTError:
|
||||
raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
|
Reference in New Issue
Block a user