Skip to content

Commit

Permalink
Add support for totp seed in invite users
Browse files Browse the repository at this point in the history
  • Loading branch information
dorsha committed Jun 27, 2024
1 parent 8bfcf5a commit b1c5f4b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions descope/management/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def __init__(
additional_login_ids: Optional[List[str]] = None,
sso_app_ids: Optional[List[str]] = None,
password: Optional[UserPassword] = None,
seed: Optional[str] = None,
):
self.login_id = login_id
self.email = email
Expand All @@ -50,6 +51,7 @@ def __init__(
self.additional_login_ids = additional_login_ids
self.sso_app_ids = sso_app_ids
self.password = password
self.seed = seed


class User(AuthBase):
Expand Down Expand Up @@ -1545,6 +1547,7 @@ def _compose_create_batch_body(
sso_app_ids=sso_app_ids,
password=password,
hashed_password=hashed_password,
seed=user.seed,
)
usersBody.append(uBody)

Expand Down Expand Up @@ -1577,6 +1580,7 @@ def _compose_update_body(
sso_app_ids: Optional[List[str]] = None,
password: Optional[str] = None,
hashed_password: Optional[dict] = None,
seed: Optional[str] = None,
) -> dict:
res = {
"loginId": login_id,
Expand Down Expand Up @@ -1605,4 +1609,6 @@ def _compose_update_body(
res["password"] = password
if hashed_password is not None:
res["hashedPassword"] = hashed_password
if seed is not None:
res["seed"] = seed
return res
2 changes: 2 additions & 0 deletions tests/management/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ def test_invite_batch(self):
rounds=8,
),
),
seed="aaa",
)
resp = self.client.mgmt.user.invite_batch(
users=[user],
Expand Down Expand Up @@ -345,6 +346,7 @@ def test_invite_batch(self):
"rounds": 8,
}
},
"seed": "aaa",
}
],
"invite": True,
Expand Down

0 comments on commit b1c5f4b

Please sign in to comment.