Skip to content

Conversation

@vddgil
Copy link

@vddgil vddgil commented Nov 20, 2025

Description

According to the documentation, the reset password response is supposed to return the user,
But, in the gem, the user was nil because the user is wrapped in {"user": {...}}
This fix extract the user from the wrapped value

@greptile-apps
Copy link

greptile-apps bot commented Nov 20, 2025

Greptile Overview

Greptile Summary

This PR re-implements the fix from PR #406 by manually parsing the JSON response to extract the user data from the wrapped {"user": {...}} format. The change is functionally correct and handles the API response properly, but uses a more verbose approach compared to the existing UserResponse class that was designed for this exact purpose.

Confidence Score: 5/5

  • This PR is safe to merge - the change correctly handles the wrapped API response
  • The implementation is functionally correct and properly extracts user data from the wrapped response format. While it could use the existing UserResponse abstraction for better code maintainability, the change doesn't introduce any bugs or security issues
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
lib/workos/user_management.rb 5/5 Replaced UserResponse.new(response.body).user with manual JSON parsing to extract user data from wrapped API response - functionally equivalent but uses a different implementation pattern

Sequence Diagram

sequenceDiagram
    participant Client
    participant UserManagement
    participant API as WorkOS API
    participant User as WorkOS::User

    Client->>UserManagement: reset_password(token, new_password)
    UserManagement->>API: POST /user_management/password_reset/confirm
    API-->>UserManagement: {"user": {id, email, ...}}
    UserManagement->>UserManagement: JSON.parse(response.body)
    UserManagement->>UserManagement: Extract parsed_response['user']
    UserManagement->>User: new(user_data.to_json)
    User-->>UserManagement: User object
    UserManagement-->>Client: User object
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant