1
0
forked from ScoDoc/ScoDoc

Fix: creation utilisateur.

This commit is contained in:
Emmanuel Viennet 2022-09-01 15:20:02 +02:00
parent 0a62ee4dad
commit 8c5da97350
2 changed files with 9 additions and 9 deletions

View File

@ -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:

View File

@ -1,7 +1,7 @@
# -*- mode: python -*-
# -*- coding: utf-8 -*-
SCOVERSION = "9.3.28"
SCOVERSION = "9.3.29"
SCONAME = "ScoDoc"