Skip to content

Conversation

@nihansofia0127
Copy link

Context

The registration logic responsible for validating usernames is implemented on the client side. To make the change, I located the validateUsername function inside public/src/client/register.js. Since the "username taken" message originates from validateUsername, this was the correct place to modify the behavior to also suggest an alternative username.

Description

This pull request updates the registration form logic in public/src/client/register.js to improve the user experience when a chosen username is already in use.

Previously, the UI only displayed an error message ("Username taken"). Now, if the entered username is taken, the form will also display a suggested alternative username by appending a "suffix" string to the original input (e.g., test123 → test123suffix).

Changes include:

Modified validateUsername():

When API checks detect the username is taken, display an error message with a suggested alternative username

Preserves existing success/error logic

Testing:

Enter a username that is known to be taken

Confirm that the error message displays along with a suggested alternative username

Enter a new, unused username to confirm normal registration behavior is unaffected

Previously, the registration form only displayed an error when a username
was already in use. This change appends a 'suffix' string to the entered
username and displays it as a suggested alternative, improving the user
experience.
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.

1 participant