From 6d6c4ee35d8a89d06528426dc1f947a5b6da283a Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Mon, 1 Sep 2025 18:20:32 -0600 Subject: [PATCH] User rename fixes. --- frontend/src/admin/AdminApp.vue | 12 ++++++------ frontend/src/components/ProfileView.vue | 10 ++++------ frontend/src/components/ResetView.vue | 15 +++------------ 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/frontend/src/admin/AdminApp.vue b/frontend/src/admin/AdminApp.vue index 67119e2..acd9f2b 100644 --- a/frontend/src/admin/AdminApp.vue +++ b/frontend/src/admin/AdminApp.vue @@ -367,17 +367,17 @@ function closeDialog() { dialog.value = { type: null, data: null, busy: false, e // Admin user rename const editingUserName = ref(false) const editUserNameValue = ref('') -const editUserNameValid = computed(()=> editUserNameValue.value.trim().length > 0 && editUserNameValue.value.trim().length <= 64) +const editUserNameValid = computed(()=> true) // backend validates function beginEditUserName() { if (!selectedUser.value) return editingUserName.value = true - editUserNameValue.value = userDetail.value?.display_name || selectedUser.value.display_name || '' + editUserNameValue.value = '' } function cancelEditUserName() { editingUserName.value = false } async function submitEditUserName() { - if (!editingUserName.value || !editUserNameValid.value) return + if (!editingUserName.value) return try { - const res = await fetch(`/auth/admin/users/${selectedUser.value.uuid}/display-name`, { method: 'PUT', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ display_name: editUserNameValue.value.trim() }) }) + const res = await fetch(`/auth/admin/users/${selectedUser.value.uuid}/display-name`, { method: 'PUT', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ display_name: editUserNameValue.value }) }) const data = await res.json(); if (!res.ok || data.detail) throw new Error(data.detail || 'Rename failed') editingUserName.value = false await loadOrgs() @@ -487,8 +487,8 @@ async function submitDialog() {

{{ userDetail?.display_name || selectedUser.display_name }} - - + +

diff --git a/frontend/src/components/ProfileView.vue b/frontend/src/components/ProfileView.vue index bde0526..b76d61b 100644 --- a/frontend/src/components/ProfileView.vue +++ b/frontend/src/components/ProfileView.vue @@ -7,8 +7,8 @@ 👤 @@ -159,14 +159,12 @@ const isAdmin = computed(() => !!(authStore.userInfo?.is_global_admin || authSto // Name editing state & actions const editingName = ref(false) const newName = ref('') -const validName = computed(() => newName.value.trim().length > 0 && newName.value.trim().length <= 64) -function startEdit() { editingName.value = true; newName.value = authStore.userInfo?.user?.user_name || '' } +function startEdit() { editingName.value = true; newName.value = '' } function cancelEdit() { editingName.value = false } async function saveName() { - if (!validName.value) return try { authStore.isLoading = true - const res = await fetch('/auth/user/display-name', { method: 'PUT', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ display_name: newName.value.trim() }) }) + const res = await fetch('/auth/user/display-name', { method: 'PUT', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ display_name: newName.value }) }) const data = await res.json(); if (!res.ok || data.detail) throw new Error(data.detail || 'Update failed') await authStore.loadUserInfo() editingName.value = false diff --git a/frontend/src/components/ResetView.vue b/frontend/src/components/ResetView.vue index 067a3f4..4da1bcb 100644 --- a/frontend/src/components/ResetView.vue +++ b/frontend/src/components/ResetView.vue @@ -28,26 +28,17 @@