Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Prevent users from setting an already used username #2651

Conversation

flacial
Copy link
Member

@flacial flacial commented Dec 26, 2022

Description

This PR aims to prevent users from setting an already used username when trying to change their username to avoid introducing bugs in the system.

Currently, there is no way to prevent users from setting their username to one that is already in use by another user. This can lead to bugs in the system because the system expects unique usernames. For example, when a user changes their username to an already used one and then goes to their profile page, the userInfo data returned may be for a different user.

This PR adds a check to ensure that a user cannot set their username to an already used one.

Changes Made

  • Added a check to ensure that a user cannot set their username to an already used one.

Testing instructions

  1. Login in
  2. Navigate to the settings/account page.
  3. Attempt to change your username to one that is already in use by another user.
  4. Observe that the username change is not allowed, and an error message is displayed.

Related issues

@vercel
Copy link

vercel bot commented Dec 26, 2022

@flacial is attempting to deploy a commit to the c0d3-prod Team on Vercel.

A member of the Team first needs to authorize it.

@codecov
Copy link

codecov bot commented Dec 26, 2022

Codecov Report

Merging #2651 (b69e615) into master (9065dce) will not change coverage.
The diff coverage is 100.00%.

❗ Current head b69e615 differs from pull request most recent head 295ef64. Consider uploading reports for the commit 295ef64 to get more accurate results

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #2651   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          189       189           
  Lines         3473      3476    +3     
  Branches       960       961    +1     
=========================================
+ Hits          3473      3476    +3     
Impacted Files Coverage Δ
pages/settings/account/index.tsx 100.00% <ø> (ø)
graphql/resolvers/userDataCrud.ts 100.00% <100.00%> (ø)

@vercel
Copy link

vercel bot commented Dec 27, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
c0d3-app ✅ Ready (Inspect) Visit Preview Dec 27, 2022 at 11:47AM (UTC)

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.

Prevent users from setting an already used username
2 participants