Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /mdfarhankc_fastapi-fullauth /examples /sqlmodel_app /auth.py
| from fastapi_fullauth import FullAuth, FullAuthConfig | |
| from fastapi_fullauth.adapters import SQLModelAdapter | |
| from fastapi_fullauth.types import UserSchema | |
| from .config import session_maker | |
| from .models import RefreshToken, Role, User, UserRole | |
| async def add_custom_claims(user: UserSchema) -> dict: | |
| return {"display_name": getattr(user, "display_name", "")} | |
| fullauth = FullAuth( | |
| adapter=SQLModelAdapter( | |
| session_maker=session_maker, | |
| user_model=User, | |
| refresh_token_model=RefreshToken, | |
| role_model=Role, | |
| user_role_model=UserRole, | |
| ), | |
| config=FullAuthConfig( | |
| SECRET_KEY="change-me-use-a-32-byte-key-here", | |
| ), | |
| on_create_token_claims=add_custom_claims, | |
| ) | |
| async def send_verification_email(email: str, token: str): | |
| print(f"\n[VERIFY] To: {email}\n[VERIFY] Token: {token}\n") | |
| async def send_password_reset_email(email: str, token: str): | |
| print(f"\n[RESET] To: {email}\n[RESET] Token: {token}\n") | |
Xet Storage Details
- Size:
- 1.07 kB
- Xet hash:
- 835fe7aefb2f3ec8be06e8e7bb9e93f24e7cd9b3fd85146c42ee6b7c87cfeacc
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.