Create a class helper to let configure the password hasher dynamically

This commit is contained in:
François Voron
2022-03-22 14:16:49 +01:00
parent 4f5676b979
commit 7f6d038d91
5 changed files with 61 additions and 28 deletions

View File

@ -22,13 +22,14 @@ from fastapi_users.manager import (
)
from fastapi_users.models import BaseOAuthAccount, BaseOAuthAccountMixin
from fastapi_users.openapi import OpenAPIResponseType
from fastapi_users.password import get_password_hash
from fastapi_users.password import PasswordHelper
guinevere_password_hash = get_password_hash("guinevere")
angharad_password_hash = get_password_hash("angharad")
viviane_password_hash = get_password_hash("viviane")
lancelot_password_hash = get_password_hash("lancelot")
excalibur_password_hash = get_password_hash("excalibur")
password_helper = PasswordHelper()
guinevere_password_hash = password_helper.hash("guinevere")
angharad_password_hash = password_helper.hash("angharad")
viviane_password_hash = password_helper.hash("viviane")
lancelot_password_hash = password_helper.hash("lancelot")
excalibur_password_hash = password_helper.hash("excalibur")
class User(models.BaseUser):