Skip to content

Fix/email readonly placeholder#55

Merged
deekshithgowda85 merged 2 commits into
deekshithgowda85:prodfrom
trivikramkalagi91-commits:fix/email-readonly-placeholder
May 29, 2026
Merged

Fix/email readonly placeholder#55
deekshithgowda85 merged 2 commits into
deekshithgowda85:prodfrom
trivikramkalagi91-commits:fix/email-readonly-placeholder

Conversation

@trivikramkalagi91-commits
Copy link
Copy Markdown
Contributor

@trivikramkalagi91-commits trivikramkalagi91-commits commented May 29, 2026

Pull Request

Summary

i have made username and name editable by removing readonly mode by following mentor guidance on issue #34 and kept email section in read mode only.
Describe what this PR changes in SecDev and why it is needed.

Closes:
#34

What Changed

  • State Binding: Instantiated functional React useState hooks and onChange event tracking inside components/console/account-page-client.tsx to handle dynamic field edits cleanly for displayName and username.
  • Permissions Updates: Removed the restrictive readOnly attributes entirely from the Display Name and Username fields, converting them to open, interactive states.
  • Email Address: Locked explicitly into a readOnly loop due to a lack of backend OTP verification, using the descriptive placeholder="Email managed by provider".
  • Type Enhancements: Appended the missing name?: string | null definition to the UserProfile type block within lib/user-auth.ts to solve compiler verification cleanly without adding unsafe suppression comments.

Verification

Screenshots or Demo

Add screenshots, screen recordings, or short notes if this changes the UI.

Verification

  • Verified local production compilation successfully compiles with zero TypeScript or ESLint errors via npm run build.
  • [ x] I checked that no secrets or hardcoded credentials were added

Note: I utilized AI tools to assist in refactoring the React state logic and structuring the type adjustments, but I have thoroughly verified, tested, and understood every code change introduced here to ensure it aligns perfectly with the codebase's architecture.

Summary by CodeRabbit

Release Notes

  • New Features
    • Display Name and Username fields in account settings are now editable. Users can update their profile information directly from their account page.
    • Email Address field remains read-only and provider-managed.

Review Change Stack

@vercel
Copy link
Copy Markdown

vercel Bot commented May 29, 2026

@trivikramkalagi91-commits is attempting to deploy a commit to the Deekshith Gowda HS's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

📝 Walkthrough

Walkthrough

The PR adds profile field editability by extending the UserProfile type to include an optional name property, then updating the account page client to manage "Display Name" and "Username" as editable React state initialized from user data, while "Email Address" remains read-only.

Changes

Profile Field Editability

Layer / File(s) Summary
UserProfile type with name field
lib/user-auth.ts
UserProfile type now declares an optional name property with string | null value shape.
Editable form fields and state management
components/console/account-page-client.tsx
Account page adds displayName and username React state (initialized from user.name or email local-part and user.id respectively) and wires both inputs as controlled form fields with change handlers. Email field remains read-only.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • deekshithgowda85/SecDev#33: Both PRs improve account profile "Display Name" and "Username" field initialization to prevent incorrect or pre-filled values.

Suggested labels

quality:clean

Poem

🐰 A profile awaits your gentle touch,
Display names and usernames now editable—
No longer locked in server dust,
Your identity bends to your will,
Fresh fields, fresh edits, fresh you! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The pull request title 'Fix/email readonly placeholder' is vague and does not clearly convey the main changes made to the codebase. Use a more descriptive title that clearly summarizes the primary changes, such as 'Make Display Name and Username editable, keep Email read-only' or 'Add user profile editing with name field support'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed: lockfile failed supply-chain policy check. Run pnpm install locally to update the lockfile.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@trivikramkalagi91-commits
Copy link
Copy Markdown
Contributor Author

hi @deekshithgowda85 i have succesfully made changes can u please review the changes and merge if possible.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@components/console/account-page-client.tsx`:
- Line 41: The state initializer currently seeds editable username from the
internal identifier (user?.id) which exposes an internal ID; change the
initialization of username in the component to use a dedicated public field
(e.g., user?.username or user?.displayName) or default to an empty string, and
update any places that read/write username (e.g., setUsername and form submit
handlers) to operate on that public username field instead of user.id so the
internal ID is never used as an editable value.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b57f22f7-04ff-483e-86ed-ea371972e882

📥 Commits

Reviewing files that changed from the base of the PR and between dbdeed8 and 1a972f5.

📒 Files selected for processing (2)
  • components/console/account-page-client.tsx
  • lib/user-auth.ts


export function AccountPageClient({ user, hasGithubConnection }: { user: UserProfile | null; hasGithubConnection: boolean }) {
const [displayName, setDisplayName] = useState(user?.name ?? user?.email?.split("@")[0] ?? "");
const [username, setUsername] = useState(user?.id ?? "");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Don’t initialize editable username from internal user.id.

Using user.id here exposes an internal identifier as a user-editable profile value. Initialize from a dedicated username source (or "") instead.

Suggested change
-  const [username, setUsername] = useState(user?.id ?? "");
+  const [username, setUsername] = useState("");
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const [username, setUsername] = useState(user?.id ?? "");
const [username, setUsername] = useState("");
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/console/account-page-client.tsx` at line 41, The state initializer
currently seeds editable username from the internal identifier (user?.id) which
exposes an internal ID; change the initialization of username in the component
to use a dedicated public field (e.g., user?.username or user?.displayName) or
default to an empty string, and update any places that read/write username
(e.g., setUsername and form submit handlers) to operate on that public username
field instead of user.id so the internal ID is never used as an editable value.

@deekshithgowda85 deekshithgowda85 merged commit 3154ae4 into deekshithgowda85:prod May 29, 2026
2 of 3 checks passed
@trivikramkalagi91-commits
Copy link
Copy Markdown
Contributor Author

thank you @deekshithgowda85

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants