mirror of
https://github.com/fastapi-users/fastapi-users.git
synced 2025-08-20 08:12:16 +08:00
Automated deployment: Fri Oct 25 06:35:09 UTC 2019 8987b1bb2a165dae2a3f8318b524d5a65e20b4a3
This commit is contained in:
@ -35,16 +35,21 @@ class User(BaseUser):
|
||||
|
||||
auth = JWTAuthentication(secret=SECRET, lifetime_seconds=3600)
|
||||
|
||||
|
||||
def on_after_forgot_password(user, token):
|
||||
print(f"User {user.id} has forgot their password. Reset token: {token}")
|
||||
|
||||
|
||||
app = FastAPI()
|
||||
fastapi_users = FastAPIUsers(user_db, auth, User, on_after_forgot_password, SECRET)
|
||||
fastapi_users = FastAPIUsers(user_db, auth, User, SECRET)
|
||||
app.include_router(fastapi_users.router, prefix="/users", tags=["users"])
|
||||
|
||||
|
||||
@fastapi_users.on_after_register()
|
||||
def on_after_register(user: User):
|
||||
print(f"User {user.id} has registered.")
|
||||
|
||||
|
||||
@fastapi_users.on_after_forgot_password()
|
||||
def on_after_forgot_password(user: User, token: str):
|
||||
print(f"User {user.id} has forgot their password. Reset token: {token}")
|
||||
|
||||
|
||||
@app.on_event("startup")
|
||||
async def startup():
|
||||
await database.connect()
|
||||
|
Reference in New Issue
Block a user