Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions descope/management/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,7 @@ def update_email(
login_id: str,
email: Optional[str] = None,
verified: Optional[bool] = None,
fail_on_conflict: Optional[bool] = None,
) -> dict:
"""
Update the email address for an existing user.
Expand All @@ -1069,6 +1070,7 @@ def update_email(
login_id (str): The login ID of the user to update the email for.
email (str): The user email address. Leave empty to remove.
verified (bool): Set to true for the user to be able to login with the email address.
fail_on_conflict (bool): Set to true to raise an error if the email is used as a login id and already exists.

Return value (dict):
Return dict in the format
Expand All @@ -1080,7 +1082,7 @@ def update_email(
"""
response = self._http.post(
MgmtV1.user_update_email_path,
body={"loginId": login_id, "email": email, "verified": verified},
body={"loginId": login_id, "email": email, "verified": verified, "failOnConflict": fail_on_conflict},
)
return response.json()

Expand All @@ -1089,6 +1091,7 @@ def update_phone(
login_id: str,
phone: Optional[str] = None,
verified: Optional[bool] = None,
fail_on_conflict: Optional[bool] = None,
) -> dict:
"""
Update the phone number for an existing user.
Expand All @@ -1097,6 +1100,7 @@ def update_phone(
login_id (str): The login ID of the user to update the phone for.
phone (str): The user phone number. Leave empty to remove.
verified (bool): Set to true for the user to be able to login with the phone number.
fail_on_conflict (bool): Set to true to raise an error if the phone is used as a login id and already exists.

Return value (dict):
Return dict in the format
Expand All @@ -1108,7 +1112,7 @@ def update_phone(
"""
response = self._http.post(
MgmtV1.user_update_phone_path,
body={"loginId": login_id, "phone": phone, "verified": verified},
body={"loginId": login_id, "phone": phone, "verified": verified, "failOnConflict": fail_on_conflict},
)
return response.json()

Expand Down
2 changes: 2 additions & 0 deletions tests/management/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -1753,6 +1753,7 @@ def test_update_email(self):
"loginId": "valid-id",
"email": "[email protected]",
"verified": None,
"failOnConflict": None,
},
allow_redirects=False,
verify=True,
Expand Down Expand Up @@ -1791,6 +1792,7 @@ def test_update_phone(self):
"loginId": "valid-id",
"phone": "+18005551234",
"verified": True,
"failOnConflict": None,
},
allow_redirects=False,
verify=True,
Expand Down