Skip to content

feat: implement unique username validation in updateProfile controller#961

Open
varshitha980-vvc wants to merge 10 commits into
aryandas2911:mainfrom
varshitha980-vvc:main
Open

feat: implement unique username validation in updateProfile controller#961
varshitha980-vvc wants to merge 10 commits into
aryandas2911:mainfrom
varshitha980-vvc:main

Conversation

@varshitha980-vvc
Copy link
Copy Markdown

Description

Added a validation check in the updateProfile controller to ensure usernames are unique before saving updates to the database.

Changes Made

  • Modified backend/controllers/authController.js to check if the requested name is already taken by another user using User.findOne({ name }).
  • Returns a 400 status with a clear error message if the username is already taken.
  • Simplified token extraction logic in backend/middlewares/authMiddleware.js.

Closes #889

@aryandas2911
Copy link
Copy Markdown
Owner

@varshitha980-vvc resolve conflicts and do linting

@varshitha980-vvc
Copy link
Copy Markdown
Author

Hi @aryandas2911 , the conflicts on this PR are fully resolved and it's ready for your review whenever you can approve the CI workflow

@aryandas2911
Copy link
Copy Markdown
Owner

@varshitha980-vvc your code is very messed up because of <<<<Head and ----- such lines, pls remove those

@aryandas2911
Copy link
Copy Markdown
Owner

@varshitha980-vvc no changes have yet been done, to the changes requested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug/UX]: "Token format invalid" locks profile name updates and lacks input validation constraints

2 participants