Skip to content

Add user input field for password length in Password Generator#225

Open
DhruvGupta6177 wants to merge 2 commits into
Axe-Pearl:masterfrom
DhruvGupta6177:master
Open

Add user input field for password length in Password Generator#225
DhruvGupta6177 wants to merge 2 commits into
Axe-Pearl:masterfrom
DhruvGupta6177:master

Conversation

@DhruvGupta6177

Copy link
Copy Markdown

Description

This PR adds a user input field to the Password Generator that allows users to specify the password length, resolving the issue of hardcoded password lengths.

Changes Made

  • ✅ Added an input field to specify password length (range: 1-128 characters)
  • ✅ Removed hardcoded password lengths (previously 13 and 12)
  • ✅ Both passwords now generate with the same user-specified length
  • ✅ Added validation for input values with user alerts
  • ✅ Styled the input field to match the existing dark theme
  • ✅ Set default password length to 12

Files Modified

  • Password Generator/index.html - Added length input field and label
  • Password Generator/index.js - Updated displayPassword() function with dynamic length logic
  • Password Generator/index.css - Added styles for the input field

Testing

The feature is fully functional and ready for use:

  1. User can enter any password length between 1-128
  2. Both generated passwords use the specified length
  3. Invalid inputs trigger alerts and reset to default
  4. Input field styling matches the existing UI theme

- Added input field to specify password length (1-128 characters)
- Removed hardcoded password lengths (13 and 12)
- Both passwords now generate with the same user-specified length
- Added validation for input values with alerts
- Styled input field to match dark theme
- Default password length set to 12
Copilot AI review requested due to automatic review settings June 3, 2026 10:56

Copilot AI left a comment

Copy link
Copy Markdown

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.

Adds a user-configurable password length input to the password generator UI and updates generation logic to respect the chosen length.

Changes:

  • Added numeric input (#passwordLength) to control generated password length.
  • Updated displayPassword() to read, validate, and clamp password length (1–128).
  • Styled the new length input group in CSS.

Reviewed changes

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

File Description
Password Generator/index.js Reads length from the new input and applies min/max validation before generating passwords.
Password Generator/index.html Adds labeled number input for password length selection.
Password Generator/index.css Adds layout and styling for the new length input group and input focus states.

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

Comment thread Password Generator/index.js
Comment thread Password Generator/index.js
Comment thread Password Generator/index.js
- Added distinct colors for = button (green) and C (Clear) button (red)
- Rounded buttons with hover effects for better UX
- Improved screen display with separate operation and result sections
- Added better visual hierarchy and contrast
- Styled screens with dark theme colors for better visibility
- Decimal button now spans full width on its own row
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.

2 participants