From a9b4510d0841c3a40f8bc9d0aab2be6d7f4f0c14 Mon Sep 17 00:00:00 2001 From: tanyar09 Date: Tue, 9 Dec 2025 14:35:30 -0500 Subject: [PATCH] feat: Enhance ManageUsers and Modify components with password visibility toggle and session state management This commit introduces a password visibility toggle in the ManageUsers component, allowing users to show or hide their password input. Additionally, the Modify component is updated to manage session state more effectively, persisting user selections and filters across page reloads. The implementation includes restoring state from sessionStorage and saving state on unmount, improving user experience. Documentation has been updated to reflect these changes. --- frontend/src/pages/ManageUsers.tsx | 74 ++++++++---- frontend/src/pages/Modify.tsx | 174 ++++++++++++++++++++++++++--- frontend/src/pages/Tags.tsx | 17 ++- 3 files changed, 225 insertions(+), 40 deletions(-) diff --git a/frontend/src/pages/ManageUsers.tsx b/frontend/src/pages/ManageUsers.tsx index 3dd59ca..ba7937f 100644 --- a/frontend/src/pages/ManageUsers.tsx +++ b/frontend/src/pages/ManageUsers.tsx @@ -117,6 +117,7 @@ export default function ManageUsers() { const [editingUser, setEditingUser] = useState(null) const [filterActive, setFilterActive] = useState(true) const [filterRole, setFilterRole] = useState(null) + const [showPassword, setShowPassword] = useState(false) const [createForm, setCreateForm] = useState({ username: '', @@ -149,12 +150,13 @@ export default function ManageUsers() { const [editingAuthUser, setEditingAuthUser] = useState(null) const [authFilterActive, setAuthFilterActive] = useState(true) const [authFilterRole, setAuthFilterRole] = useState(null) // 'Admin' or 'User' + const [showAuthPassword, setShowAuthPassword] = useState(false) const [authCreateForm, setAuthCreateForm] = useState({ email: '', name: '', password: '', - is_admin: false, + is_admin: true, has_write_access: false, }) @@ -399,6 +401,7 @@ const getDisplayRoleLabel = (user: UserResponse): string => { role: createRole, }) setShowCreateModal(false) + setShowPassword(false) setCreateForm({ username: '', password: '', @@ -469,11 +472,12 @@ const getDisplayRoleLabel = (user: UserResponse): string => { email: trimmedEmail, }) setShowAuthCreateModal(false) + setShowAuthPassword(false) setAuthCreateForm({ email: '', name: '', password: '', - is_admin: false, + is_admin: true, has_write_access: false, }) loadAuthUsers() @@ -838,7 +842,7 @@ const getDisplayRoleLabel = (user: UserResponse): string => { email: '', name: '', password: '', - is_admin: false, + is_admin: true, has_write_access: false, }) setShowAuthCreateModal(true) @@ -1403,16 +1407,26 @@ const getDisplayRoleLabel = (user: UserResponse): string => { - - setCreateForm({ ...createForm, password: e.target.value }) - } - className="w-full px-3 py-2 border border-gray-300 rounded-md" - required - minLength={6} - /> +
+ + setCreateForm({ ...createForm, password: e.target.value }) + } + className="w-full px-3 py-2 pr-10 border border-gray-300 rounded-md" + required + minLength={6} + /> + +