fix(users) Display name should be created when user is created
This commit is contained in:
parent
b94319c38f
commit
06caec86e7
|
@ -76,8 +76,6 @@ def reset_password(token: str, password: str):
|
||||||
@Hook
|
@Hook
|
||||||
def update_user(user):
|
def update_user(user):
|
||||||
current_app.config["FG_AUTH_BACKEND"].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()
|
db.session.commit()
|
||||||
|
|
||||||
|
|
||||||
|
@ -159,6 +157,8 @@ def find_user(uid_mail):
|
||||||
else:
|
else:
|
||||||
user = current_app.config["FG_AUTH_BACKEND"].find_user(uid_mail, uid_mail if mail else None)
|
user = current_app.config["FG_AUTH_BACKEND"].find_user(uid_mail, uid_mail if mail else None)
|
||||||
if user:
|
if user:
|
||||||
|
if not user.display_name:
|
||||||
|
user.display_name = "{} {}.".format(user.firstname, user.lastname[0])
|
||||||
db.session.add(user)
|
db.session.add(user)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
return user
|
return user
|
||||||
|
|
Loading…
Reference in New Issue