forked from ScoDoc/ScoDoc
user_info: tolère comptes supprimés ou inexistants
This commit is contained in:
parent
0b5b0f8079
commit
8feff2b182
@ -343,8 +343,12 @@ def user_info(user_name_or_id=None, user: User = None):
|
|||||||
info = None
|
info = None
|
||||||
user_name = "inconnu"
|
user_name = "inconnu"
|
||||||
else:
|
else:
|
||||||
info = user.to_dict()
|
if user is None: # utilisateur supprimé (rare)
|
||||||
user_name = user.user_name
|
user_name = "inconnu !"
|
||||||
|
info = None
|
||||||
|
else:
|
||||||
|
info = user.to_dict()
|
||||||
|
user_name = user.user_name
|
||||||
|
|
||||||
if not info:
|
if not info:
|
||||||
# special case: user is not in our database
|
# special case: user is not in our database
|
||||||
@ -365,11 +369,10 @@ def user_info(user_name_or_id=None, user: User = None):
|
|||||||
"status": "",
|
"status": "",
|
||||||
"date_expiration": None,
|
"date_expiration": None,
|
||||||
}
|
}
|
||||||
else:
|
# Ensure we never publish password hash
|
||||||
# Ensure we never publish password hash
|
if "password_hash" in info:
|
||||||
if "password_hash" in info:
|
del info["password_hash"]
|
||||||
del info["password_hash"]
|
return info
|
||||||
return info
|
|
||||||
|
|
||||||
|
|
||||||
MSG_OPT = """<br>Attention: (vous pouvez forcer l'opération en cochant "<em>Ignorer les avertissements</em>" en bas de page)"""
|
MSG_OPT = """<br>Attention: (vous pouvez forcer l'opération en cochant "<em>Ignorer les avertissements</em>" en bas de page)"""
|
||||||
|
Loading…
Reference in New Issue
Block a user