From 06caec86e74ecef989c7beee1aa5ee1f978f928f Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Mon, 29 Nov 2021 11:33:23 +0100 Subject: [PATCH] fix(users) Display name should be created when user is created --- flaschengeist/controller/userController.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flaschengeist/controller/userController.py b/flaschengeist/controller/userController.py index 0722d66..fff534c 100644 --- a/flaschengeist/controller/userController.py +++ b/flaschengeist/controller/userController.py @@ -76,8 +76,6 @@ 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() @@ -159,6 +157,8 @@ def find_user(uid_mail): else: user = current_app.config["FG_AUTH_BACKEND"].find_user(uid_mail, uid_mail if mail else None) if user: + if not user.display_name: + user.display_name = "{} {}.".format(user.firstname, user.lastname[0]) db.session.add(user) db.session.commit() return user