From 20e2f5992680ed5b6410e478ca705513c6e14b33 Mon Sep 17 00:00:00 2001 From: Etienne Boileau Date: Wed, 15 May 2024 14:43:19 +0200 Subject: [PATCH] FIX username --- client/src/components/project/ProjectForm.vue | 2 +- server/src/scimodom/api/user.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/client/src/components/project/ProjectForm.vue b/client/src/components/project/ProjectForm.vue index c83cb0d9..8b9cf6af 100644 --- a/client/src/components/project/ProjectForm.vue +++ b/client/src/components/project/ProjectForm.vue @@ -62,7 +62,7 @@ const onSubmit = handleSubmit((values) => { }) onMounted(() => { - HTTPSecure.get('/access/username') + HTTPSecure.get('/user/get_username') .then((response) => { contact_email.value = response.data.username }) diff --git a/server/src/scimodom/api/user.py b/server/src/scimodom/api/user.py index ad3a9470..8c6f67af 100644 --- a/server/src/scimodom/api/user.py +++ b/server/src/scimodom/api/user.py @@ -139,3 +139,10 @@ def may_change_dataset(dataset_id): return {"message": "Unknown dataset"}, 404 return {"write_access": permission_service.may_change_dataset(user, dataset)} + + +@user_api.route("/get_username", methods=["GET"]) +@jwt_required() +def get_username(): + email = get_jwt_identity() + return jsonify(username=email), 200