mirror of
https://github.com/vxcontrol/pentagi.git
synced 2026-07-19 12:11:02 -04:00
[PR #340] Replace Change Password with My Profile (email and password update) #328
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/vxcontrol/pentagi/pull/340
Author: @Akalanka1337
Created: 6/5/2026
Status: 🔄 Open
Base:
main← Head:user-profile-email-update📝 Commits (1)
82bca05feat(webui): replace Change Password with My Profile (email and password updates)📊 Changes
15 files changed (+663 additions, -12 deletions)
View changed files
📝
backend/go.mod(+2 -0)📝
backend/go.sum(+1 -0)📝
backend/pkg/server/docs/docs.go(+81 -0)📝
backend/pkg/server/docs/swagger.json(+81 -0)📝
backend/pkg/server/docs/swagger.yaml(+54 -0)📝
backend/pkg/server/models/init.go(+1 -0)📝
backend/pkg/server/models/users.go(+24 -0)📝
backend/pkg/server/response/errors.go(+3 -0)📝
backend/pkg/server/response/http_test.go(+3 -0)📝
backend/pkg/server/router.go(+1 -0)📝
backend/pkg/server/services/users.go(+83 -0)📝
backend/pkg/server/services/users_test.go(+90 -0)📝
frontend/src/components/layouts/main-sidebar.tsx(+11 -12)➕
frontend/src/features/authentication/email-change-form.tsx(+189 -0)➕
frontend/src/features/authentication/profile-dialog.tsx(+39 -0)📄 Description
This PR replaces the simple Change Password option in the user sidebar dropdown with a unified My Profile section. Logged-in local users can now manage their email address (requires their existing password for security) and change their password from a tabbed modal dialog.
Key Changes
Backend
PUT /api/v1/user/email):/userrouter group utilizing thelocalUserRequiredmiddleware.bcrypt.CompareHashAndPassword) to ensure users confirm their identity.EmailChangestruct and registered it for validation.ErrChangeEmailCurrentUserInvalidEmail,ErrChangeEmailCurrentUserInvalidCurrentPassword,ErrChangeEmailCurrentUserEmailAlreadyExists) for accurate error handling.Frontend
EmailChangeForm): Added a React Hook Form with Zod validation to submit to the new PUT endpoint.ProfileDialog): Added a tabbed modal layout hosting both Update Email and Change Password tabs.MainSidebar): Replaced the "Change Password" item in the user dropdown menu with "My Profile" (usingUserIcon).Verification & Testing
Automated Backend Tests
Added a new unit test suite
TestChangeEmailCurrentUserinpkg/server/services/users_test.gocovering:All package tests pass successfully: