diff --git a/app/commands.py b/app/commands.py index 87860a360ed8d1c5006d16c95f771c1f95e54d8f..1075ba19ae9419f7fe1435bf8aef28bf9f98302e 100644 --- a/app/commands.py +++ b/app/commands.py @@ -54,7 +54,9 @@ def sync_user(connection, user): disable_user(user) else: attributes = ldap_user["attributes"] - user.display_name = utils.attribute_to_string(attributes["cn"]) + user.display_name = ( + utils.attribute_to_string(attributes["cn"]) or user.username + ) user.email = utils.attribute_to_string(attributes["mail"]) groups = ldap_manager.get_user_groups( dn=ldap3.utils.conv.escape_filter_chars(ldap_user["dn"]),