diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ad9b14d167c3e4fdb7752151c5f5559782d9842..98ae4000c009979b7ad4a97d8f3b3bc2bf762088 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed ### +* [caosdb-server#142](https://gitlab.com/caosdb/caosdb-server/-/issues/142) + Can't create users with dots in their user names + ### Security ### ### Documentation ### diff --git a/src/caosdb/common/administration.py b/src/caosdb/common/administration.py index cef0bd1cf6fceb9d8ec89324ba9ca540b79889cb..98d4d2826da7131ef79b5c3cc9b3d9597abc0248 100644 --- a/src/caosdb/common/administration.py +++ b/src/caosdb/common/administration.py @@ -196,17 +196,9 @@ def _update_user(name, realm=None, password=None, status=None, e.msg = "You are not permitted to update this user." raise e except HTTPClientError as e: - if e.status == 409: - e.msg = "Entity does not exist." - - if e.status == 422: - e.msg = """Maybe the password does not match the required standard? - The current requirements are: - - at least 8 characters - - at least 1 number - - at least 1 lower case character - - at least 1 upper case character - - at least 1 special character""" + for elem in etree.fromstring(e.body): + if elem.tag == "Error": + e.msg = elem.get("description") raise @@ -231,17 +223,9 @@ def _insert_user(name, password=None, status=None, email=None, entity=None, **kw e.msg = "You are not permitted to insert a new user." raise e except HTTPClientError as e: - if e.status == 409: - e.msg = "User name is already in use." - - if e.status == 422: - e.msg = """Maybe the password does not match the required standard? - The current requirements are: - - at least 8 characters - - at least 1 number - - at least 1 lower case character - - at least 1 upper case character - - at least 1 special character""" + for elem in etree.fromstring(e.body): + if elem.tag == "Error": + e.msg = elem.get("description") raise e