Skip to content

Implement <ChangeCredential /> component across NextJs, Nuxt, Node and Express SDKs - #103

Open
janithjay wants to merge 1 commit into
thunder-id:mainfrom
janithjay:update-cred-new-password-only
Open

janithjay wants to merge 1 commit into
thunder-id:mainfrom
janithjay:update-cred-new-password-only

Conversation

@janithjay

@janithjay janithjay commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Purpose

There was no way for a signed-in user to update their own credentials from @thunderid/nextjs, @thunderid/nuxt, @thunderid/node, or @thunderid/express. BaseUserProfile deliberately filters credential attributes out of the profile form, so password was unreachable from any SDK component, even though the backend already supports POST /users/me/update-credentials.

This PR adds a ChangeCredential component to @thunderid/nextjs and @thunderid/nuxt, wires it into a real "My Account" page (Personal info + Security) in both quickstart samples, and adds the underlying capability to @thunderid/node and @thunderid/express for apps without a UI component layer.

Fixed a bug: the Nuxt quickstart's profile update returned 500 (Schema validation failed).

Approach

ChangeCredential component (new)

Framework Flow
Next.js ThunderIDNextClient.updateUserCredentials()updateUserCredentialsAction (server action, maps errors server-side, same pattern as updateUserProfileAction) → <ChangeCredential />, which wraps @thunderid/react's BaseChangeCredential
Nuxt ThunderIDNuxtClient.updateUserCredentials() → new Nitro route PATCH /api/auth/user/credentials (mirrors profile.patch.ts) → <ChangeCredential />, which wraps @thunderid/vue's BaseChangeCredential

Node / Express (new)

Neither has a UI component layer, so this is a headless client method rather than a component:

  • @thunderid/node: ThunderIDNodeClient.updateUserCredentials(payload, userId?) - new method calling the core updateMeCredentials function with the session's access token attached, resolved via resolveResourceEndpoint('usersMeCredentials', configData) the same way every other SDK does.
  • @thunderid/express: ThunderIDExpressClient.updateUserCredentialsFromRequest(req, payload) - mirrors the existing getUserFromRequest(req) pattern: reads the session cookie, then calls the inherited updateUserCredentials.
  • express/quickstart sample: new PATCH /api/me/credentials route (bearer-token protected, consistent with the sample's other /api/* routes), plus a Postman collection entry and README update.

Bug fix: Nuxt profile update returning 500

  • Root cause: the backend's Schema.Validate() validates the entire submitted attributes payload, it doesn't merge the edit with the already-stored entity first. React and Vue's UserProfile containers already deepMerge the edited field onto the stored profile before submitting, but Nuxt's container sent only the edited field, so every single-field edit failed validation.
  • Fix: applied the same deepMerge step Nuxt was missing.
New Interface
image image image image

Related Issues

Related PRs

Checklist

  • Followed the contribution guidelines.
  • Manual test round performed and verified.
  • Documentation provided. (Add links if there are any)
  • Tests provided. (Add links if there are any)
    • Unit Tests
    • Integration Tests
  • Breaking changes. (Fill if applicable)
    • Breaking changes section filled.
    • breaking change label added.

Security checks

  • Followed secure coding standards.
  • Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 471a46ef-8fad-44c5-9430-51be7e467435


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.

@janithjay
janithjay force-pushed the update-cred-new-password-only branch 5 times, most recently from ee82871 to 887cf88 Compare September 16, 2026 02:52
Signed-off-by: janithjay <janithjayashan018@gmail.com>
@janithjay
janithjay force-pushed the update-cred-new-password-only branch from 887cf88 to fd241fb Compare September 16, 2026 03:58
@janithjay janithjay changed the title Implement <ChangeCredential /> component across NextJs and Nuxt SDKs Implement <ChangeCredential /> component across NextJs, Nuxt, Node and Express SDKs Sep 16, 2026
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