fix(users) Display name should be created when user is created

This commit is contained in:
Ferdinand Thiessen 2021-11-29 11:33:23 +01:00
parent b94319c38f
commit 06caec86e7
1 changed files with 2 additions and 2 deletions

View File

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