Skip to content

fix: add maxLength validation on username input field#935

Merged
JhaSourav07 merged 4 commits into
JhaSourav07:mainfrom
meetparmar392005:fix/username-input-validation
May 28, 2026
Merged

fix: add maxLength validation on username input field#935
JhaSourav07 merged 4 commits into
JhaSourav07:mainfrom
meetparmar392005:fix/username-input-validation

Conversation

@meetparmar392005
Copy link
Copy Markdown
Contributor

Fixes #930

Description

Added input validation on the username field to prevent inputs exceeding GitHub's 39 character username limit.

Changes Made

  • Added maxLength={39} attribute to username input
  • Added a user-friendly warning message when the character limit is reached

Pillar

🐛 Bug Fix — Input validation

Checklist

  • I have read CONTRIBUTING.md
  • npm run lint passes locally
  • npm run test passes locally ✅
  • No SVG output changes

Copilot AI review requested due to automatic review settings May 28, 2026 11:17
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 28, 2026

@meetparmar392005 is attempting to deploy a commit to the jhasourav07's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Copy Markdown

👋 Hey @meetparmar392005, welcome to CommitPulse! 🎉

Thanks for opening your first pull request — this is a big deal and we appreciate the effort!

While you wait for a review, please double-check:

  • ✅ You've read the CONTRIBUTING.md checklist
  • npm run lint, npm run format, and npm run test all pass locally
  • ✅ Your PR has a visual preview if it touches any SVG output
  • 💬 You've joined our Discord for faster PR feedback

A maintainer will review your PR shortly. Hang tight! 🚀

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR tightens GitHub username input handling in the landing page UI and updates the /api/streak invalid-parameters test to assert a structured JSON error response.

Changes:

  • Add a 39-character limit to the GitHub username input and display a helper/error message at the limit.
  • Update the streak API test to parse JSON and validate error/details fields for invalid parameters.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
app/page.tsx Adds maxLength for GitHub usernames and renders a length-related message in the form UI.
app/api/streak/route.test.ts Updates invalid-parameter assertions to expect a JSON error payload with details.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/page.tsx
className="flex-1 rounded-xl border border-black/10 bg-gray-100 px-5 py-3.5 text-sm text-black outline-none transition-all duration-200 placeholder:text-gray-500 focus:outline-none focus:ring-2 focus:ring-[#00ffaa] focus:border-transparent dark:border-[rgba(255,255,255,0.08)] dark:bg-[#111] dark:text-white dark:placeholder:text-[#A1A1AA]"
value={username}
onChange={(e) => setUsername(e.target.value)}
maxLength={39}
Comment thread app/page.tsx Outdated
Comment thread app/page.tsx
Comment thread app/page.tsx
const body = await response.text();
expect(body).toContain('Missing');
const body = await response.json();
expect(response.status).toBe(400);
@Aamod007
Copy link
Copy Markdown
Collaborator

@meetparmar392005 make pr according to guideline

@github-actions github-actions Bot added the type:bug Something isn't working as expected label May 28, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@JhaSourav07 JhaSourav07 added GSSoC 2026 level:beginner Small changes Usually isolated fixes or simple UI/text updates. quality:exceptional Outstanding contribution with exceptional implementation quality, testing. gssoc:approved PR has been reviewed and accepted for valid contribution points mentor:Aamod007 labels May 28, 2026
@github-actions github-actions Bot added this to the GSSoC 2026 milestone May 28, 2026
@JhaSourav07 JhaSourav07 merged commit 82ce406 into JhaSourav07:main May 28, 2026
8 of 9 checks passed
@github-actions
Copy link
Copy Markdown

🎉 Congratulations @meetparmar392005! Your PR has been successfully merged. 🚀

Thank you for contributing to CommitPulse. Your work helps us build a better tool for the community.

⚠️ Important for GSSoC Contributors:
You are strictly advised to join our Discord Server as it is mandatory for all GSSoC participants. All important announcements, point claims, and community discussions happen there.

Keep building! 💻✨

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

Labels

gssoc:approved PR has been reviewed and accepted for valid contribution points GSSoC 2026 level:beginner Small changes Usually isolated fixes or simple UI/text updates. mentor:Aamod007 quality:exceptional Outstanding contribution with exceptional implementation quality, testing. type:bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: No input validation on username field — accepts unlimited characters

4 participants