Automated deployment: Fri Oct 25 06:35:09 UTC 2019 8987b1bb2a165dae2a3f8318b524d5a65e20b4a3

This commit is contained in:
frankie567
2019-10-25 06:35:09 +00:00
parent bc14e9a225
commit 9b336bdda1
5 changed files with 78 additions and 45 deletions

View File

@ -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()