From 8c5da973507625c3d5f6330c35989f08971ccd59 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Thu, 1 Sep 2022 15:20:02 +0200 Subject: [PATCH] Fix: creation utilisateur. --- app/views/users.py | 16 ++++++++-------- sco_version.py | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/views/users.py b/app/views/users.py index b95c75912..43d347d7d 100644 --- a/app/views/users.py +++ b/app/views/users.py @@ -530,16 +530,16 @@ def create_user_form(user_name=None, edit=0, all_roles=True): else: user_name = vals["user_name"] # ce login existe ? - err = None - existing_user = User.query.filter_by(user_name=user_name) + err_msg = None + existing_user = User.query.filter_by(user_name=user_name).count() > 0 if ( - edit and existing_user is None + edit and not existing_user ): # safety net, le user_name ne devrait pas changer - err = f"identifiant {user_name} inexistant" - if not edit and existing_user is not None: - err = f"identifiant %{user_name} déjà utilisé" - if err: - H.append(tf_error_message(f"""Erreur: {err}""")) + err_msg = f"identifiant {user_name} inexistant" + if not edit and not existing_user: + err_msg = f"identifiant {user_name} déjà utilisé" + if err_msg: + H.append(tf_error_message(f"""Erreur: {err_msg}""")) return "\n".join(H) + "\n" + tf[1] + F if not edit_only_roles: diff --git a/sco_version.py b/sco_version.py index fd6f02b18..bc55b7eba 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.3.28" +SCOVERSION = "9.3.29" SCONAME = "ScoDoc"