RocketChat / RocketChat/Rocket.Chat

Username availability check missing in Setup Wizard admin step

Open
#38,990 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: bug
Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

Description:

In AdminInfoStep.tsx, the username validation was missing an API check to verify if the username is already taken:

Expected Behavior

validateUsernameshould call the users.checkUsernameAvailabilityAPI endpoint and return an error message if the username is already in use.

Current Behavior

// TODO: check if username exists
const validateUsername = (username: string): boolean | string => {
	if (!usernameRegExp.test(username) || hasBlockedName(username)) {
		return t('Invalid_username');
	}

	return true;
};

Steps to Reproduce

See packages/ui-client/src/views/setupWizard/steps/AdminInfoStep.tsx

Additional Context

  • checkUsernameAvailability endpoint GET /v1/users.checkUsernameAvailability is already available in the API
  • No runtime behavior changes beyond the added API call
  • The following should be changed in AdminInfoStep.tsx, SetupWizardContext.ts, SetupWizardProvider.tsx

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with packages/ui-client/src/views/setupWizard/steps/AdminInfoStep.tsx and trace the username validation flow into SetupWizardContext.ts and SetupWizardProvider.tsx. Confirm how the existing users.checkUsernameAvailability endpoint is called, then verify that an already-used username produces an error while valid available names still pass validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.