From e4a10028b7e65a0370e224bb900917b59dd77734 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Wed, 1 Dec 2021 15:19:29 +0100 Subject: [PATCH] fix(users): Update hook needs to check existence of display_name as well --- flaschengeist/controller/userController.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flaschengeist/controller/userController.py b/flaschengeist/controller/userController.py index 4374db8..944565e 100644 --- a/flaschengeist/controller/userController.py +++ b/flaschengeist/controller/userController.py @@ -78,6 +78,8 @@ def reset_password(token: str, password: str): @Hook def update_user(user): current_app.config["FG_AUTH_BACKEND"].update_user(user) + if not user.display_name: + user.display_name = "{} {}.".format(user.firstname, user.lastname[0]) db.session.commit()