From fa99cbf3d02a0ed6ed2c5c1e3b541aec181a537c Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Thu, 13 Jan 2022 23:30:25 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20#269.=20Utilisateurs=20avec=20logins=20nu?= =?UTF-8?q?m=C3=A9riques.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/views/users.py b/app/views/users.py index af4a721ed..cc9b9db01 100644 --- a/app/views/users.py +++ b/app/views/users.py @@ -151,6 +151,8 @@ def user_info(user_name, format="json"): @scodoc7func def create_user_form(user_name=None, edit=0, all_roles=1): "form. création ou edition utilisateur" + if user_name is not None: # scodoc7func converti en int ! + user_name = str(user_name) auth_dept = current_user.dept from_mail = current_user.email initvalues = {} @@ -745,6 +747,8 @@ def user_info_page(user_name=None): """ from app.scodoc.sco_permissions_check import can_handle_passwd + if user_name is not None: # scodoc7func converti en int ! + user_name = str(user_name) # peut on divulguer ces infos ? if not can_handle_passwd(current_user, allow_admindepts=True): raise AccessDenied("Vous n'avez pas la permission de voir cette page") @@ -753,7 +757,7 @@ def user_info_page(user_name=None): if not user_name: user = current_user else: - user = User.query.filter_by(user_name=str(user_name)).first() + user = User.query.filter_by(user_name=user_name).first() if not user: raise ScoValueError("invalid user_name") @@ -802,6 +806,8 @@ def form_change_password(user_name=None): """Formulaire de changement mot de passe de l'utilisateur user_name. Un utilisateur peut toujours changer son propre mot de passe. """ + if user_name is not None: # scodoc7func converti en int ! + user_name = str(user_name) if not user_name: user = current_user else: @@ -850,6 +856,8 @@ def form_change_password(user_name=None): @scodoc7func def change_password(user_name, password, password2): "Change the password for user given by user_name" + if user_name is not None: # scodoc7func converti en int ! + user_name = str(user_name) u = User.query.filter_by(user_name=user_name).first() # Check access permission if not can_handle_passwd(u): @@ -909,6 +917,8 @@ def change_password(user_name, password, password2): @permission_required(Permission.ScoUsersAdmin) def toggle_active_user(user_name: str = None): """Change active status of a user account""" + if user_name is not None: # scodoc7func converti en int ! + user_name = str(user_name) u = User.query.filter_by(user_name=user_name).first() if not u: raise ScoValueError("invalid user_name")