diff --git a/configuration/full_example/index.html b/configuration/full_example/index.html index c3cad9a5..aa65c81b 100644 --- a/configuration/full_example/index.html +++ b/configuration/full_example/index.html @@ -572,16 +572,21 @@ 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() diff --git a/configuration/router/index.html b/configuration/router/index.html index 9e68c7b5..bcd776d1 100644 --- a/configuration/router/index.html +++ b/configuration/router/index.html @@ -404,13 +404,27 @@