Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /mdfarhankc_fastapi-fullauth /examples /sqlalchemy_app /auth.py
| from fastapi_fullauth import FullAuth, FullAuthConfig | |
| from fastapi_fullauth.adapters import SQLAlchemyAdapter | |
| 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=SQLAlchemyAdapter( | |
| 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:
- bde32b1fa5aeb3480bece15b3654ca342ce73143714ad3290aedddd50fbee4a0
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.