Skip to content

Commit

Permalink
fix: login methods and user put
Browse files Browse the repository at this point in the history
  • Loading branch information
sattvikc committed Nov 8, 2024
1 parent 9100e11 commit 420dd03
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [unreleased]

## [0.25.1] - 2024-11-07
## [0.25.1] - 2024-11-08

- Fixes issues with dashboard - userroles and tenants
- Fixes `LoginMethod` to json conversion to not include `null` as values
- Adds `to_json` method to `TenantConfig`

## [0.25.0] - 2024-09-18
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,9 @@ async def handle_user_put(
user_context,
)

if isinstance(email_update_response, EmailChangeNotAllowedErrorResponse):
return EmailChangeNotAllowedErrorResponse(email_update_response.error)

if not isinstance(email_update_response, OkResponse):
return email_update_response

Expand All @@ -350,6 +353,9 @@ async def handle_user_put(
user_context,
)

if isinstance(phone_update_response, PhoneNumberChangeNotAllowedErrorResponse):
return PhoneNumberChangeNotAllowedErrorResponse(phone_update_response.error)

if not isinstance(phone_update_response, OkResponse):
return phone_update_response

Expand Down
12 changes: 8 additions & 4 deletions supertokens_python/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,20 @@ def has_same_third_party_info_as(
)

def to_json(self) -> Dict[str, Any]:
return {
result: Dict[str, Any] = {
"recipeId": self.recipe_id,
"recipeUserId": self.recipe_user_id.get_as_string(),
"tenantIds": self.tenant_ids,
"email": self.email,
"phoneNumber": self.phone_number,
"thirdParty": self.third_party.to_json() if self.third_party else None,
"timeJoined": self.time_joined,
"verified": self.verified,
}
if self.email is not None:
result["email"] = self.email
if self.phone_number is not None:
result["phoneNumber"] = self.phone_number
if self.third_party is not None:
result["thirdParty"] = self.third_party.to_json()
return result

@staticmethod
def from_json(json: Dict[str, Any]) -> "LoginMethod":
Expand Down

0 comments on commit 420dd03

Please sign in to comment.