Skip to content

Feature/72/update user password#73

Merged
Kimoo193 merged 6 commits into
mainfrom
feature/72/update-user-password
Apr 5, 2025
Merged

Feature/72/update user password#73
Kimoo193 merged 6 commits into
mainfrom
feature/72/update-user-password

Conversation

@Kimoo193
Copy link
Copy Markdown
Contributor

@Kimoo193 Kimoo193 commented Apr 5, 2025

PR Checklist (required)

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines.

  • Tests for the changes have been added (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation changes
  • Other... Please describe:

Related Issue

Closes #

@Kimoo193 Kimoo193 added the feature For new feature label Apr 5, 2025
@Kimoo193 Kimoo193 requested a review from Copilot April 5, 2025 12:47
@Kimoo193 Kimoo193 self-assigned this Apr 5, 2025
@Kimoo193 Kimoo193 linked an issue Apr 5, 2025 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.

Files not reviewed (1)
  • src/docs/swagger.json: Language not supported
Comments suppressed due to low confidence (2)

src/middlewares/verifyUserPermission.middleware.js:2

  • The additional email-based permission check (req.user.email === req.params.email) may unintentionally grant access since the route does not provide an 'email' parameter. Please verify if this condition is necessary.
if (req.params.id === req.user.id || req.user.role === 'ADMIN' || req.user.email === req.params.email) {

src/validations/user.validation.js:45

  • Consider passing { abortEarly: false } to schema.validate for consistency with other validations and to capture all errors in one go.
return schema.validate(obj);

@Kimoo193
Copy link
Copy Markdown
Contributor Author

Kimoo193 commented Apr 5, 2025

This pull request introduces several changes to the user management functionality, including updates to user routes, controllers, validations, and documentation. The most significant changes are the addition of a new endpoint for updating user passwords and improvements to the validation and permission checks.

New Features:

  • Added a new endpoint for updating user passwords: PUT /api/users/update-password/:id in src/controllers/user.controller.js and src/routes/user.routes.js. [1] [2]

Validation Enhancements:

  • Updated validation to include password update validation and allowed unknown fields in user account validation in src/validations/user.validation.js.

Documentation Updates:

  • Updated README.md to reflect changes in user routes and added documentation for the new password update endpoint in src/docs/swagger.json. [1] [2] [3]

Permission Checks:

  • Enhanced the verifyUserPermission middleware to allow email-based permission checks in src/middlewares/verifyUserPermission.middleware.js.

Utility Functions:

  • Imported password utility functions (comparePassword, hashPassword) in src/controllers/user.controller.js to handle password comparisons and hashing.

@Kimoo193 Kimoo193 merged commit 0c37b75 into main Apr 5, 2025
11 checks passed
@Kimoo193 Kimoo193 deleted the feature/72/update-user-password branch April 5, 2025 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature For new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update user password

2 participants