user_info: tolère comptes supprimés ou inexistants

This commit is contained in:
Emmanuel Viennet 2024-10-17 11:45:54 +02:00
parent 0b5b0f8079
commit 8feff2b182

View File

@ -343,8 +343,12 @@ def user_info(user_name_or_id=None, user: User = None):
info = None
user_name = "inconnu"
else:
info = user.to_dict()
user_name = user.user_name
if user is None: # utilisateur supprimé (rare)
user_name = "inconnu !"
info = None
else:
info = user.to_dict()
user_name = user.user_name
if not info:
# special case: user is not in our database
@ -365,11 +369,10 @@ def user_info(user_name_or_id=None, user: User = None):
"status": "",
"date_expiration": None,
}
else:
# Ensure we never publish password hash
if "password_hash" in info:
del info["password_hash"]
return info
# Ensure we never publish password hash
if "password_hash" in info:
del info["password_hash"]
return info
MSG_OPT = """<br>Attention: (vous pouvez forcer l'opération en cochant "<em>Ignorer les avertissements</em>" en bas de page)"""