From 9b336bdda185d6076333336512bb186ffe1f194e Mon Sep 17 00:00:00 2001 From: frankie567 Date: Fri, 25 Oct 2019 06:35:09 +0000 Subject: [PATCH] Automated deployment: Fri Oct 25 06:35:09 UTC 2019 8987b1bb2a165dae2a3f8318b524d5a65e20b4a3 --- configuration/full_example/index.html | 17 +++-- configuration/router/index.html | 87 ++++++++++++++++---------- search/search_index.json | 2 +- sitemap.xml.gz | Bin 204 -> 204 bytes src/full_sqlalchemy.py | 17 +++-- 5 files changed, 78 insertions(+), 45 deletions(-) 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 @@