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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ repos:
- id: pyupgrade
args: [--py38-plus]
- repo: https://github.com/pycqa/flake8
rev: 7.1.2
rev: 7.2.0
hooks:
- id: flake8
additional_dependencies: [Flake8-pyproject]
Expand All @@ -52,7 +52,7 @@ repos:
- id: tox-ini-fmt
args: ["-p", "type"]
- repo: https://github.com/gitleaks/gitleaks
rev: v8.24.2
rev: v8.24.3
hooks:
- id: gitleaks
- repo: local
Expand Down
11 changes: 10 additions & 1 deletion descope/authmethod/enchantedlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@
add_to_login_ids: bool = False,
on_merge_use_existing: bool = False,
template_options: dict | None = None,
template_id: str | None = None,
provider_id: str | None = None,
) -> dict:
if not login_id:
raise AuthException(
Expand All @@ -116,7 +118,8 @@
Auth.validate_email(email)

body = EnchantedLink._compose_update_user_email_body(
login_id, email, add_to_login_ids, on_merge_use_existing, template_options
login_id, email, add_to_login_ids, on_merge_use_existing,
template_options, template_id, provider_id
)
uri = EndpointsV1.update_user_email_enchantedlink_path
response = self._auth.do_post(uri, body, None, refresh_token)
Expand Down Expand Up @@ -181,6 +184,8 @@
add_to_login_ids: bool,
on_merge_use_existing: bool,
template_options: dict | None = None,
template_id: str | None = None,
provider_id: str | None = None,
) -> dict:
body: dict[str, str | bool | dict] = {
"loginId": login_id,
Expand All @@ -190,6 +195,10 @@
}
if template_options is not None:
body["templateOptions"] = template_options
if template_id is not None:
body["templateId"] = template_id

Check warning on line 199 in descope/authmethod/enchantedlink.py

View workflow job for this annotation

GitHub Actions / Coverage

This line has no coverage
if provider_id is not None:
body["providerId"] = provider_id

Check warning on line 201 in descope/authmethod/enchantedlink.py

View workflow job for this annotation

GitHub Actions / Coverage

This line has no coverage

return body

Expand Down
22 changes: 20 additions & 2 deletions descope/authmethod/magiclink.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@
add_to_login_ids: bool = False,
on_merge_use_existing: bool = False,
template_options: dict | None = None,
template_id: str | None = None,
provider_id: str | None = None,
) -> str:
if not login_id:
raise AuthException(
Expand All @@ -115,7 +117,8 @@
Auth.validate_email(email)

body = MagicLink._compose_update_user_email_body(
login_id, email, add_to_login_ids, on_merge_use_existing, template_options
login_id, email, add_to_login_ids, on_merge_use_existing,
template_options, template_id, provider_id
)
uri = EndpointsV1.update_user_email_magiclink_path
response = self._auth.do_post(uri, body, None, refresh_token)
Expand All @@ -130,6 +133,8 @@
add_to_login_ids: bool = False,
on_merge_use_existing: bool = False,
template_options: dict | None = None,
template_id: str | None = None,
provider_id: str | None = None,
) -> str:
if not login_id:
raise AuthException(
Expand All @@ -139,7 +144,8 @@
Auth.validate_phone(method, phone)

body = MagicLink._compose_update_user_phone_body(
login_id, phone, add_to_login_ids, on_merge_use_existing, template_options
login_id, phone, add_to_login_ids, on_merge_use_existing,
template_options, template_id, provider_id
)
uri = EndpointsV1.update_user_phone_magiclink_path
response = self._auth.do_post(uri, body, None, refresh_token)
Expand Down Expand Up @@ -203,6 +209,8 @@
add_to_login_ids: bool,
on_merge_use_existing: bool,
template_options: dict | None = None,
template_id: str | None = None,
provider_id: str | None = None,
) -> dict:
body: dict[str, str | bool | dict] = {
"loginId": login_id,
Expand All @@ -212,6 +220,10 @@
}
if template_options is not None:
body["templateOptions"] = template_options
if template_id is not None:
body["templateId"] = template_id

Check warning on line 224 in descope/authmethod/magiclink.py

View workflow job for this annotation

GitHub Actions / Coverage

This line has no coverage
if provider_id is not None:
body["providerId"] = provider_id

Check warning on line 226 in descope/authmethod/magiclink.py

View workflow job for this annotation

GitHub Actions / Coverage

This line has no coverage

return body

Expand All @@ -222,6 +234,8 @@
add_to_login_ids: bool,
on_merge_use_existing: bool,
template_options: dict | None = None,
template_id: str | None = None,
provider_id: str | None = None,
) -> dict:
body: dict[str, str | bool | dict] = {
"loginId": login_id,
Expand All @@ -231,5 +245,9 @@
}
if template_options is not None:
body["templateOptions"] = template_options
if template_id is not None:
body["templateId"] = template_id

Check warning on line 249 in descope/authmethod/magiclink.py

View workflow job for this annotation

GitHub Actions / Coverage

This line has no coverage
if provider_id is not None:
body["providerId"] = provider_id

Check warning on line 251 in descope/authmethod/magiclink.py

View workflow job for this annotation

GitHub Actions / Coverage

This line has no coverage

return body
22 changes: 20 additions & 2 deletions descope/authmethod/otp.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@
add_to_login_ids: bool = False,
on_merge_use_existing: bool = False,
template_options: dict | None = None,
template_id: str | None = None,
provider_id: str | None = None,
) -> str:
"""
Update the email address of an end user, after verifying the authenticity of the end user using OTP.
Expand All @@ -196,7 +198,8 @@

uri = EndpointsV1.update_user_email_otp_path
body = OTP._compose_update_user_email_body(
login_id, email, add_to_login_ids, on_merge_use_existing, template_options
login_id, email, add_to_login_ids, on_merge_use_existing,
template_options, template_id, provider_id
)
response = self._auth.do_post(uri, body, None, refresh_token)
return Auth.extract_masked_address(response.json(), DeliveryMethod.EMAIL)
Expand All @@ -210,6 +213,8 @@
add_to_login_ids: bool = False,
on_merge_use_existing: bool = False,
template_options: dict | None = None,
template_id: str | None = None,
provider_id: str | None = None,
) -> str:
"""
Update the phone number of an existing end user, after verifying the authenticity of the end user using OTP.
Expand All @@ -236,7 +241,8 @@

uri = OTP._compose_update_phone_url(method)
body = OTP._compose_update_user_phone_body(
login_id, phone, add_to_login_ids, on_merge_use_existing, template_options
login_id, phone, add_to_login_ids, on_merge_use_existing,
template_options, template_id, provider_id
)
response = self._auth.do_post(uri, body, None, refresh_token)
return Auth.extract_masked_address(response.json(), method)
Expand Down Expand Up @@ -299,6 +305,8 @@
add_to_login_ids: bool,
on_merge_use_existing: bool,
template_options: dict | None = None,
template_id: str | None = None,
provider_id: str | None = None,
) -> dict:
body: dict[str, str | bool | dict] = {
"loginId": login_id,
Expand All @@ -308,6 +316,10 @@
}
if template_options is not None:
body["templateOptions"] = template_options
if template_id is not None:
body["templateId"] = template_id

Check warning on line 320 in descope/authmethod/otp.py

View workflow job for this annotation

GitHub Actions / Coverage

This line has no coverage
if provider_id is not None:
body["providerId"] = provider_id

Check warning on line 322 in descope/authmethod/otp.py

View workflow job for this annotation

GitHub Actions / Coverage

This line has no coverage

return body

Expand All @@ -318,6 +330,8 @@
add_to_login_ids: bool,
on_merge_use_existing: bool,
template_options: dict | None = None,
template_id: str | None = None,
provider_id: str | None = None,
) -> dict:
body: dict[str, str | bool | dict] = {
"loginId": login_id,
Expand All @@ -327,5 +341,9 @@
}
if template_options is not None:
body["templateOptions"] = template_options
if template_id is not None:
body["templateId"] = template_id

Check warning on line 345 in descope/authmethod/otp.py

View workflow job for this annotation

GitHub Actions / Coverage

This line has no coverage
if provider_id is not None:
body["providerId"] = provider_id

Check warning on line 347 in descope/authmethod/otp.py

View workflow job for this annotation

GitHub Actions / Coverage

This line has no coverage

return body
Loading