[PR #5767] fix: name username input validation #5339

Open
opened 2026-03-17 02:47:43 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/5767
Author: @Saqibaqeel
Created: 1/12/2026
Status: 🔄 Open

Base: mainHead: fix/username-validation


📝 Commits (1)

  • 96bdb8d fix: name username input validation

📊 Changes

1 file changed (+9 additions, -8 deletions)

View changed files

📝 packages/hoppscotch-common/src/components/collections/EditRequest.vue (+9 -8)

📄 Description

Closes #

This PR adds proper validation for usernames in the request modal. It ensures that only valid characters are allowed and prevents users from submitting invalid names.

What's changed

  • Added a regex for username validation:

    • Allows letters (a–z, A–Z), numbers (0–9), underscores (_), and hyphens (-)
    • Minimum length: 1, Maximum length: 50 characters
  • Shows a toast error message if the username is invalid

  • Prevents form submission when the username does not meet the criteria

  • Username input now validated

  • Toast error implemented for invalid usernames

  • Submission blocked on invalid input

Notes to reviewers

  • Tested locally in the Hoppscotch dev environment
  • Regex used: /^[a-zA-Z0-9_-]{1,50}$/
  • Only affects the request modal input field

Summary by cubic

Adds strict validation to the Request Name field in Edit Request. Trims input, blocks invalid names, and shows an error toast.

  • Bug Fixes
    • Validate with /^[A-Za-z0-9 _-]{1,50}$/ (letters, numbers, spaces, underscores, hyphens).
    • Submit the trimmed name; block submit and show an error toast when invalid.

Written for commit 96bdb8d985. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/5767 **Author:** [@Saqibaqeel](https://github.com/Saqibaqeel) **Created:** 1/12/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/username-validation` --- ### 📝 Commits (1) - [`96bdb8d`](https://github.com/hoppscotch/hoppscotch/commit/96bdb8d98543726cc2ae871f3d92ee53253c409b) fix: name username input validation ### 📊 Changes **1 file changed** (+9 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-common/src/components/collections/EditRequest.vue` (+9 -8) </details> ### 📄 Description <!-- Thanks for creating this pull request 🤗 --> <!-- If this pull request closes an issue, please mention the issue number below --> Closes #<insert-issue-number-if-any> <!-- Add an introduction into what this PR tries to solve in a couple of sentences --> This PR adds proper validation for usernames in the request modal. It ensures that only valid characters are allowed and prevents users from submitting invalid names. ### What's changed - Added a regex for username validation: - Allows letters (a–z, A–Z), numbers (0–9), underscores (_), and hyphens (-) - Minimum length: 1, Maximum length: 50 characters - Shows a toast error message if the username is invalid - Prevents form submission when the username does not meet the criteria - [x] Username input now validated - [x] Toast error implemented for invalid usernames - [x] Submission blocked on invalid input ### Notes to reviewers - Tested locally in the Hoppscotch dev environment - Regex used: `/^[a-zA-Z0-9_-]{1,50}$/` - Only affects the request modal input field <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds strict validation to the Request Name field in Edit Request. Trims input, blocks invalid names, and shows an error toast. - **Bug Fixes** - Validate with /^[A-Za-z0-9 _-]{1,50}$/ (letters, numbers, spaces, underscores, hyphens). - Submit the trimmed name; block submit and show an error toast when invalid. <sup>Written for commit 96bdb8d98543726cc2ae871f3d92ee53253c409b. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#5339
No description provided.