Fix #1172: expose is_verified_by_default argument on FastAPIUsers.get_oauth_router

This commit is contained in:
François Voron
2023-03-15 13:33:52 +01:00
parent 185f4d38da
commit 5561a528db

View File

@ -95,6 +95,7 @@ class FastAPIUsers(Generic[models.UP, models.ID]):
state_secret: SecretType,
redirect_url: Optional[str] = None,
associate_by_email: bool = False,
is_verified_by_default: bool = False,
) -> APIRouter:
"""
Return an OAuth router for a given OAuth client and authentication backend.
@ -106,6 +107,9 @@ class FastAPIUsers(Generic[models.UP, models.ID]):
If not given, the URL to the callback endpoint will be generated.
:param associate_by_email: If True, any existing user with the same
e-mail address will be associated to this user. Defaults to False.
:param is_verified_by_default: If True, the `is_verified` flag will be
set to `True` on newly created user. Make sure the OAuth Provider you're
using does verify the email address before enabling this flag.
"""
return get_oauth_router(
oauth_client,
@ -114,6 +118,7 @@ class FastAPIUsers(Generic[models.UP, models.ID]):
state_secret,
redirect_url,
associate_by_email,
is_verified_by_default,
)
def get_oauth_associate_router(