mirror of
https://github.com/fastapi-users/fastapi-users.git
synced 2026-03-13 07:49:55 +08:00
* Improve test coverage of BaseUserDatabase * Improve unit test isolation * Improve coverage of router and authentication
This commit is contained in:
@@ -2,8 +2,8 @@ from typing import List, Optional
|
||||
|
||||
from fastapi.security import OAuth2PasswordRequestForm
|
||||
|
||||
from fastapi_users import password
|
||||
from fastapi_users.models import BaseUserDB
|
||||
from fastapi_users.password import get_password_hash, verify_and_update_password
|
||||
|
||||
|
||||
class BaseUserDatabase:
|
||||
@@ -41,12 +41,12 @@ class BaseUserDatabase:
|
||||
|
||||
# Always run the hasher to mitigate timing attack
|
||||
# Inspired from Django: https://code.djangoproject.com/ticket/20760
|
||||
get_password_hash(credentials.password)
|
||||
password.get_password_hash(credentials.password)
|
||||
|
||||
if user is None:
|
||||
return None
|
||||
else:
|
||||
verified, updated_password_hash = verify_and_update_password(
|
||||
verified, updated_password_hash = password.verify_and_update_password(
|
||||
credentials.password, user.hashed_password
|
||||
)
|
||||
if not verified:
|
||||
|
||||
Reference in New Issue
Block a user