From 8feff2b18234efef12784b7e56e65414aafbe715 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Thu, 17 Oct 2024 11:45:54 +0200 Subject: [PATCH] =?UTF-8?q?user=5Finfo:=20tol=C3=A8re=20comptes=20supprim?= =?UTF-8?q?=C3=A9s=20ou=20inexistants?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/sco_users.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/app/scodoc/sco_users.py b/app/scodoc/sco_users.py index d08e7602f..d31c08380 100644 --- a/app/scodoc/sco_users.py +++ b/app/scodoc/sco_users.py @@ -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 = """
Attention: (vous pouvez forcer l'opération en cochant "Ignorer les avertissements" en bas de page)"""