Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add `ACCOUNT_SET_PASSWORD_REQUESTED` webhook event (#13555)

Artur842b1e3663ef
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fe67c6dc47..05937405f3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -98,6 +98,8 @@ Shipping methods can be removed by the user after it has been assigned to a chec
- Called after account deletion is confirmed with `accountDelete` mutation.
- Add `ACCOUNT_EMAIL_CHANGED` webhook - #13537, by @Air-t
- Called when `confirmEmailChange` mutation is triggered.
+- Add `ACCOUNT_SET_PASSWORD_REQUESTED` webhook - #13486, by @Air-t
+ - Called after `requestPasswordReset` or `customerCreate` mutation.
### Other changes
- Add possibility to log without confirming email - #13059 by @kadewu
diff --git a/saleor/graphql/account/mutations/authentication/request_password_reset.py b/saleor/graphql/account/mutations/authentication/request_password_reset.py
index 91beaef585..ecdc6e3e50 100644
--- a/saleor/graphql/account/mutations/authentication/request_password_reset.py
+++ b/saleor/graphql/account/mutations/authentication/request_password_reset.py
@@ -1,12 +1,15 @@
+from urllib.parse import urlencode
+
import graphene
from django.conf import settings
+from django.contrib.auth.tokens import default_token_generator
from django.core.exceptions import ValidationError
from django.utils import timezone
from .....account.error_codes import AccountErrorCode
from .....account.notifications import send_password_reset_notification
from .....account.utils import retrieve_user_by_email
-from .....core.utils.url import validate_storefront_url
+from .....core.utils.url import prepare_url, validate_storefront_url
from .....webhook.event_types import WebhookEventAsyncType
from ....channel.utils import clean_channel, validate_channel
from ....core import ResolveInfo
@@ -47,7 +50,11 @@ class RequestPasswordReset(BaseMutation):
WebhookEventInfo(
type=WebhookEventAsyncType.NOTIFY_USER,
description="A notification for password reset.",
- )
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ACCOUNT_SET_PASSWORD_REQUESTED,
+ description="Setting a new password for the account is requested.",
+ ),
]
@classmethod
@@ -99,8 +106,10 @@ class RequestPasswordReset(BaseMutation):
def perform_mutation(cls, _root, info: ResolveInfo, /, **data):
email = data["email"]
redirect_url = data["redirect_url"]
- channel_slug = data.get("channel")
user = cls.clean_user(email, redirect_url, info)
+ channel_slug = data.get("channel")
+ token = default_token_generator.make_token(user)
+ params = urlencode({"email": user.email, "token": token})
if not user.is_staff:
channel_slug = clean_channel(
@@ -110,6 +119,7 @@ class RequestPasswordReset(BaseMutation):
channel_slug = validate_channel(
channel_slug, error_class=AccountErrorCode
).slug
+
manager = get_plugin_manager_promise(info.context).get()
send_password_reset_notification(
redirect_url,
@@ -118,6 +128,14 @@ class RequestPasswordReset(BaseMutation):
channel_slug=channel_slug,
staff=user.is_staff,
)
+ cls.call_event(
+ manager.account_set_password_requested,
+ user,
+ channel_slug,
+ token,
+ prepare_url(params, redirect_url),
+ )
user.last_password_reset_request = timezone.now()
user.save(update_fields=["last_password_reset_request"])
+
return RequestPasswordReset()
diff --git a/saleor/graphql/account/mutations/base.py b/saleor/graphql/account/mutations/base.py
index af1bdcb241..aafe6e6159 100644
--- a/saleor/graphql/account/mutations/base.py
+++ b/saleor/graphql/account/mutations/base.py
@@ -1,7 +1,9 @@
from collections import defaultdict
from typing import List
+from urllib.parse import urlencode
import graphene
+from django.contrib.auth.tokens import default_token_generator
from django.core.exceptions import ValidationError
from ....account import events as account_events
@@ -11,7 +13,7 @@ from ....account.search import prepare_user_search_document_value
from ....checkout import AddressType
from ....core.exceptions import PermissionDenied
from ....core.tracing import traced_atomic_transaction
-from ....core.utils.url import validate_storefront_url
+from ....core.utils.url import prepare_url, validate_storefront_url
from ....giftcard.search import mark_gift_cards_search_index_as_dirty
from ....giftcard.utils import get_user_gift_cards
from ....graphql.utils import get_user_or_app_from_context
@@ -325,7 +327,7 @@ class BaseCustomerCreate(ModelMutation, I18nMixin):
else:
manager.customer_updated(instance)
- if cleaned_input.get("redirect_url"):
+ if redirect_url := cleaned_input.get("redirect_url"):
channel_slug = cleaned_input.get("channel")
if not instance.is_staff:
channel_slug = clean_channel(
@@ -335,13 +337,21 @@ class BaseCustomerCreate(ModelMutation, I18nMixin):
channel_slug = validate_channel(
channel_slug, error_class=AccountErrorCode
).slug
-
send_set_password_notification(
- cleaned_input.get("redirect_url"),
+ redirect_url,
instance,
manager,
channel_slug,
)
+ token = default_token_generator.make_token(instance)
+ params = urlencode({"email": instance.email, "token": token})
+ cls.call_event(
+ manager.account_set_password_requested,
+ instance,
+ channel_slug,
+ token,
+ prepare_url(params, redirect_url),
+ )
@classmethod
def post_save_action(cls, info: ResolveInfo, instance, cleaned_input):
diff --git a/saleor/graphql/account/mutations/staff/customer_create.py b/saleor/graphql/account/mutations/staff/customer_create.py
index 4cf1d3f40c..81fc5ec1a7 100644
--- a/saleor/graphql/account/mutations/staff/customer_create.py
+++ b/saleor/graphql/account/mutations/staff/customer_create.py
@@ -33,4 +33,8 @@ class CustomerCreate(BaseCustomerCreate):
type=WebhookEventAsyncType.NOTIFY_USER,
description="A notification for setting the password.",
),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ACCOUNT_SET_PASSWORD_REQUESTED,
+ description="Setting a new password for the account is requested.",
+ ),
]
diff --git a/saleor/graphql/account/tests/mutations/authentication/test_request_password_reset.py b/saleor/graphql/account/tests/mutations/authentication/test_request_password_reset.py
index b0b454c315..affe1e8cbe 100644
--- a/saleor/graphql/account/tests/mutations/authentication/test_request_password_reset.py
+++ b/saleor/graphql/account/tests/mutations/authentication/test_request_password_reset.py
@@ -30,7 +30,9 @@ REQUEST_PASSWORD_RESET_MUTATION = """
@freeze_time("2018-05-31 12:00:01")
@patch("saleor.plugins.manager.PluginsManager.notify")
+@patch("saleor.plugins.manager.PluginsManager.account_set_password_requested")
def test_account_reset_password(
+ mocked_account_set_password_requested,
mocked_notify,
user_api_client,
customer_user,
@@ -69,6 +71,10 @@ def test_account_reset_password(
user.refresh_from_db()
assert user.last_password_reset_request == timezone.now()
+ mocked_account_set_password_requested.assert_called_once_with(
+ user, channel_PLN.slug, token, reset_url
+ )
+
@freeze_time("2018-05-31 12:00:01")
@patch("saleor.plugins.manager.PluginsManager.notify")
diff --git a/saleor/graphql/account/tests/mutations/staff/test_customer_create.py b/saleor/graphql/account/tests/mutations/staff/test_customer_create.py
index dc3898084b..fc1060847e 100644
--- a/saleor/graphql/account/tests/mutations/staff/test_customer_create.py
+++ b/saleor/graphql/account/tests/mutations/staff/test_customer_create.py
@@ -82,7 +82,9 @@ CUSTOMER_CREATE_MUTATION = """
@patch("saleor.plugins.manager.PluginsManager.customer_metadata_updated")
@patch("saleor.account.notifications.default_token_generator.make_token")
@patch("saleor.plugins.manager.PluginsManager.notify")
+@patch("saleor.plugins.manager.PluginsManager.account_set_password_requested")
def test_customer_create(
+ mocked_account_set_password_requested,
mocked_notify,
mocked_generator,
mocked_customer_metadata_updated,
@@ -183,6 +185,10 @@ def test_customer_create(
assert customer_creation_event.type == account_events.CustomerEvents.ACCOUNT_CREATED
assert customer_creation_event.user == new_customer
+ mocked_account_set_password_requested.assert_called_once_with(
+ new_user, channel_PLN.slug, "token", password_set_url
+ )
+
@patch("saleor.account.notifications.default_token_generator.make_token")
@patch("saleor.plugins.manager.PluginsManager.notify")
@@ -365,3 +371,46 @@ def test_customer_create_with_non_unique_external_reference(
assert error["field"] == "externalReference"
assert error["code"] == AccountErrorCode.UNIQUE.name
assert error["message"] == "User with this External reference already exists."
+
+
+@patch("saleor.account.notifications.default_token_generator.make_token")
+@patch("saleor.plugins.webhook.plugin.trigger_webhooks_async")
+def test_customer_create_webhook_event_triggered(
+ mocked_trigger_webhooks_async,
+ mocked_generator,
+ settings,
+ user_api_client,
+ subscription_account_set_password_requested_webhook,
+ staff_api_client,
+ address,
+ channel_PLN,
+ permission_manage_users,
+):
+ # given
+ settings.PLUGINS = ["saleor.plugins.webhook.plugin.WebhookPlugin"]
+ mocked_generator.return_value = "token"
+ email = "[email protected]"
+ address_data = convert_dict_keys_to_camel_case(address.as_data())
+ address_data.pop("privateMetadata")
+
+ variables = {
+ "email": email,
+ "firstName": "api_first_name",
+ "lastName": "api_last_name",
+ "note": "Test user",
+ "shipping": address_data,
+ "billing": address_data,
+ "redirect_url": "https://www.example.com",
+ "languageCode": "PL",
+ "channel": channel_PLN.slug,
+ "externalReference": "test-ext-ref",
+ }
+
+ # when
+ staff_api_client.post_graphql(
+ CUSTOMER_CREATE_MUTATION, variables, permissions=[permission_manage_users]
+ )
+
+ # then
+ User.objects.get(email=email)
+ mocked_trigger_webhooks_async.assert_called()
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index f38a1ff90a..55dac618cf 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -1728,6 +1728,9 @@ enum WebhookEventTypeEnum @doc(category: "Webhooks") {
"""An account email was changed"""
ACCOUNT_EMAIL_CHANGED
+ """Setting a new password for the account is requested."""
+ ACCOUNT_SET_PASSWORD_REQUESTED
+
"""An account is confirmed."""
ACCOUNT_CONFIRMED
@@ -2384,6 +2387,9 @@ enum WebhookEventTypeAsyncEnum @doc(category: "Webhooks") {
"""An account email was changed"""
ACCOUNT_EMAIL_CHANGED
+ """Setting a new password for the account is requested."""
+ ACCOUNT_SET_PASSWORD_REQUESTED
+
"""An account is confirmed."""
ACCOUNT_CONFIRMED
@@ -3393,6 +3399,7 @@ enum WebhookSampleEventTypeEnum @doc(category: "Webhooks") {
ACCOUNT_CONFIRMATION_REQUESTED
ACCOUNT_CHANGE_EMAIL_REQUESTED
ACCOUNT_EMAIL_CHANGED
+ ACCOUNT_SET_PASSWORD_REQUESTED
ACCOUNT_CONFIRMED
ACCOUNT_DELETE_REQUESTED
ACCOUNT_DELETED
@@ -17900,6 +17907,7 @@ type Mutation {
Triggers the following webhook events:
- NOTIFY_USER (async): A notification for password reset.
+ - ACCOUNT_SET_PASSWORD_REQUESTED (async): Setting a new password for the account is requested.
"""
requestPasswordReset(
"""
@@ -17914,7 +17922,7 @@ type Mutation {
URL of a view where users should be redirected to reset the password. URL in RFC 1808 format.
"""
redirectUrl: String!
- ): RequestPasswordReset @doc(category: "Users") @webhookEventsInfo(asyncEvents: [NOTIFY_USER], syncEvents: [])
+ ): RequestPasswordReset @doc(category: "Users") @webhookEventsInfo(asyncEvents: [NOTIFY_USER, ACCOUNT_SET_PASSWORD_REQUESTED], syncEvents: [])
"""
Sends a notification confirmation.
@@ -18219,11 +18227,12 @@ type Mutation {
- CUSTOMER_CREATED (async): A new customer account was created.
- CUSTOMER_METADATA_UPDATED (async): Optionally called when customer's metadata was updated.
- NOTIFY_USER (async): A notification for setting the password.
+ - ACCOUNT_SET_PASSWORD_REQUESTED (async): Setting a new password for the account is requested.
"""
customerCreate(
"""Fields required to create a customer."""
input: UserCreateInput!
- ): CustomerCreate @doc(category: "Users") @webhookEventsInfo(asyncEvents: [CUSTOMER_CREATED, CUSTOMER_METADATA_UPDATED, NOTIFY_USER], syncEvents: [])
+ ): CustomerCreate @doc(category: "Users") @webhookEventsInfo(asyncEvents: [CUSTOMER_CREATED, CUSTOMER_METADATA_UPDATED, NOTIFY_USER, ACCOUNT_SET_PASSWORD_REQUESTED], syncEvents: [])
"""
Updates an existing customer.
@@ -28107,8 +28116,9 @@ Sends an email with the account password modification link.
Triggers the following webhook events:
- NOTIFY_USER (async): A notification for password reset.
+- ACCOUNT_SET_PASSWORD_REQUESTED (async): Setting a new password for the account is requested.
"""
-type RequestPasswordReset @doc(category: "Users") @webhookEventsInfo(asyncEvents: [NOTIFY_USER], syncEvents: []) {
+type RequestPasswordReset @doc(category: "Users") @webhookEventsInfo(asyncEvents: [NOTIFY_USER, ACCOUNT_SET_PASSWORD_REQUESTED], syncEvents: []) {
accountErrors: [AccountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [AccountError!]!
}
@@ -28471,8 +28481,9 @@ Triggers the following webhook events:
- CUSTOMER_CREATED (async): A new customer account was created.
- CUSTOMER_METADATA_UPDATED (async): Optionally called when customer's metadata was updated.
- NOTIFY_USER (async): A notification for setting the password.
+- ACCOUNT_SET_PASSWORD_REQUESTED (async): Setting a new password for the account is requested.
"""
-type CustomerCreate @doc(category: "Users") @webhookEventsInfo(asyncEvents: [CUSTOMER_CREATED, CUSTOMER_METADATA_UPDATED, NOTIFY_USER], syncEvents: []) {
+type CustomerCreate @doc(category: "Users") @webhookEventsInfo(asyncEvents: [CUSTOMER_CREATED, CUSTOMER_METADATA_UPDATED, NOTIFY_USER, ACCOUNT_SET_PASSWORD_REQUESTED], syncEvents: []) {
accountErrors: [AccountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [AccountError!]!
user: User
@@ -29227,6 +29238,40 @@ type AccountEmailChanged implements Event {
newEmail: String
}
+"""
+Event sent when setting a new password is requested.
+
+Added in Saleor 3.15.
+"""
+type AccountSetPasswordRequested implements Event {
+ """Time of the event."""
+ issuedAt: DateTime
+
+ """Saleor version that triggered the event."""
+ version: String
+
+ """The user or application that triggered the event."""
+ issuingPrincipal: IssuingPrincipal
+
+ """The application receiving the webhook."""
+ recipient: App
+
+ """The URL to redirect the user after he accepts the request."""
+ redirectUrl: String
+
+ """The user the event relates to."""
+ user: User
+
+ """The channel data."""
+ channel: Channel
+
+ """The token required to confirm request."""
+ token: String
+
+ """Shop data."""
+ shop: Shop
+}
+
"""
Event sent when account is confirmed.
diff --git a/saleor/graphql/webhook/enums.py b/saleor/graphql/webhook/enums.py
index dd5cf43a5f..5199228477 100644
--- a/saleor/graphql/webhook/enums.py
+++ b/saleor/graphql/webhook/enums.py
@@ -42,6 +42,9 @@ WEBHOOK_EVENT_DESCRIPTION = {
WebhookEventAsyncType.ACCOUNT_CHANGE_EMAIL_REQUESTED: (
"An account email change is requested."
),
+ WebhookEventAsyncType.ACCOUNT_SET_PASSWORD_REQUESTED: (
+ "Setting a new password for the account is requested."
+ ),
WebhookEventAsyncType.ACCOUNT_CONFIRMED: "An account is confirmed.",
WebhookEventAsyncType.ACCOUNT_DELETE_REQUESTED: "An account delete is requested.",
WebhookEventAsyncType.ACCOUNT_DELETED: "An account is deleted.",
diff --git a/saleor/graphql/webhook/subscription_types.py b/saleor/graphql/webhook/subscription_types.py
index 59de7dcbf2..6c7c615f43 100644
--- a/saleor/graphql/webhook/subscription_types.py
+++ b/saleor/graphql/webhook/subscription_types.py
@@ -226,6 +226,16 @@ class AccountEmailChanged(SubscriptionObjectType, AccountOperationBase):
description = "Event sent when account email is changed." + ADDED_IN_315
+class AccountSetPasswordRequested(SubscriptionObjectType, AccountOperationBase):
+ class Meta:
+ root_type = None
+ enable_dry_run = False
+ interfaces = (Event,)
+ description = (
+ "Event sent when setting a new password is requested." + ADDED_IN_315
+ )
+
+
class AccountDeleteRequested(SubscriptionObjectType, AccountOperationBase):
class Meta:
root_type = "User"
@@ -2162,6 +2172,7 @@ WEBHOOK_TYPES_MAP = {
WebhookEventAsyncType.ACCOUNT_CONFIRMATION_REQUESTED: AccountConfirmationRequested,
WebhookEventAsyncType.ACCOUNT_CHANGE_EMAIL_REQUESTED: AccountChangeEmailRequested,
WebhookEventAsyncType.ACCOUNT_EMAIL_CHANGED: AccountEmailChanged,
+ WebhookEventAsyncType.ACCOUNT_SET_PASSWORD_REQUESTED: AccountSetPasswordRequested,
WebhookEventAsyncType.ACCOUNT_CONFIRMED: AccountConfirmed,
WebhookEventAsyncType.ACCOUNT_DELETE_REQUESTED: AccountDeleteRequested,
WebhookEventAsyncType.ACCOUNT_DELETED: AccountDeleted,
diff --git a/saleor/plugins/base_plugin.py b/saleor/plugins/base_plugin.py
index b8bc67df34..7a842dcf50 100644
--- a/saleor/plugins/base_plugin.py
+++ b/saleor/plugins/base_plugin.py
@@ -171,6 +171,12 @@ class BasePlugin:
# change email is requested.
account_change_email_requested: Callable[["User", str, str, str, str, None], None]
+ # Trigger when account set password is requested.
+ #
+ # Overwrite this method if you need to trigger specific logic after an account
+ # set password is requested.
+ account_set_password_requested: Callable[["User", str, str, str, None], None]
+
# Trigger when account delete is confirmed.
#
# Overwrite this method if you need to trigger specific logic after an account
diff --git a/saleor/plugins/manager.py b/saleor/plugins/manager.py
index d77570d4e7..7326130ed6 100644
--- a/saleor/plugins/manager.py
+++ b/saleor/plugins/manager.py
@@ -1099,6 +1099,23 @@ class PluginsManager(PaymentInterface):
user,
)
+ def account_set_password_requested(
+ self,
+ user: "User",
+ channel_slug: str,
+ token: str,
+ redirect_url: str,
+ ):
+ default_value = None
+ return self.__run_method_on_plugins(
+ "account_set_password_requested",
+ default_value,
+ user,
+ channel_slug,
+ token=token,
+ redirect_url=redirect_url,
+ )
+
def account_delete_requested(
self, user: "User", channel_slug: str, token: str, redirect_url: str
):
diff --git a/saleor/plugins/webhook/plugin.py b/saleor/plugins/webhook/plugin.py
index 9446424f2e..84e25f6bfe 100644
--- a/saleor/plugins/webhook/plugin.py
+++ b/saleor/plugins/webhook/plugin.py
@@ -251,6 +251,24 @@ class WebhookPlugin(BasePlugin):
user,
)
+ def account_set_password_requested(
+ self,
+ user: "User",
+ channel_slug: str,
+ token: str,
+ redirect_url: str,
+ previous_value: None,
+ ) -> None:
+ if not self.active:
+ return previous_value
+ self._trigger_account_request_event(
+ WebhookEventAsyncType.ACCOUNT_SET_PASSWORD_REQUESTED,
+ user,
+ channel_slug,
+ token,
+ redirect_url,
+ )
+
def account_delete_requested(
self,
user: "User",
diff --git a/saleor/plugins/webhook/tests/subscription_webhooks/fixtures.py b/saleor/plugins/webhook/tests/subscription_webhooks/fixtures.py
index 6ee8864dee..e56f2759b1 100644
--- a/saleor/plugins/webhook/tests/subscription_webhooks/fixtures.py
+++ b/saleor/plugins/webhook/tests/subscription_webhooks/fixtures.py
@@ -60,6 +60,14 @@ def subscription_account_delete_requested_webhook(subscription_webhook):
)
+def subscription_account_set_password_requested_webhook(subscription_webhook):
+ return subscription_webhook(
+ queries.ACCOUNT_SET_PASSWORD_REQUESTED,
+ WebhookEventAsyncType.ACCOUNT_SET_PASSWORD_REQUESTED,
+ )
+
+
@pytest.fixture
def subscription_account_deleted_webhook(subscription_webhook):
return subscription_webhook(
diff --git a/saleor/plugins/webhook/tests/subscription_webhooks/subscription_queries.py b/saleor/plugins/webhook/tests/subscription_webhooks/subscription_queries.py
index 21caae97ea..c91fff2d11 100644
--- a/saleor/plugins/webhook/tests/subscription_webhooks/subscription_queries.py
+++ b/saleor/plugins/webhook/tests/subscription_webhooks/subscription_queries.py
@@ -115,6 +115,33 @@ ACCOUNT_DELETE_REQUESTED = (
"""
)
+ACCOUNT_SET_PASSWORD_REQUESTED = (
+ fragments.CUSTOMER_DETAILS
+ + """
+ subscription{
+ event{
+ ...on AccountSetPasswordRequested{
+ user{
+ ...CustomerDetails
+ }
+ token
+ redirectUrl
+ channel{
+ slug
+ id
+ }
+ shop{
+ domain{
+ host
+ url
+ }
+ }
+ }
+ }
+ }
+"""
+)
+
ACCOUNT_DELETED = (
fragments.CUSTOMER_DETAILS
+ """
diff --git a/saleor/plugins/webhook/tests/subscription_webhooks/test_create_deliveries_for_subscription.py b/saleor/plugins/webhook/tests/subscription_webhooks/test_create_deliveries_for_subscription.py
index b7ce898690..5093ba8b3e 100644
--- a/saleor/plugins/webhook/tests/subscription_webhooks/test_create_deliveries_for_subscription.py
+++ b/saleor/plugins/webhook/tests/subscription_webhooks/test_create_deliveries_for_subscription.py
@@ -207,6 +207,35 @@ def test_account_delete_requested(
assert deliveries[0].webhook == webhooks[0]
+def test_account_set_password_requested(
+ customer_user, channel_USD, subscription_account_set_password_requested_webhook
+):
+ # given
+ webhooks = [subscription_account_set_password_requested_webhook]
+ event_type = WebhookEventAsyncType.ACCOUNT_SET_PASSWORD_REQUESTED
+
+ # when
+ deliveries = create_deliveries_for_subscriptions(
+ event_type,
+ {
+ "user": customer_user,
+ "channel_slug": channel_USD.slug,
+ "token": "token",
+ "redirect_url": "http://www.mirumee.com?token=token",
+ },
+ webhooks,
+ )
+
+ # then
+ expected_payload = generate_account_requested_events_payload(
+ customer_user, channel_USD
+ )
+
+ assert deliveries[0].payload.payload == expected_payload
+ assert len(deliveries) == len(webhooks)
+ assert deliveries[0].webhook == webhooks[0]
+
+
def test_account_deleted_confirmed(customer_user, subscription_account_deleted_webhook):
# given
webhooks = [subscription_account_deleted_webhook]
diff --git a/saleor/webhook/event_types.py b/saleor/webhook/event_types.py
index ac09618746..1ff06a32a9 100644
--- a/saleor/webhook/event_types.py
+++ b/saleor/webhook/event_types.py
@@ -25,6 +25,7 @@ class WebhookEventAsyncType:
ACCOUNT_CONFIRMATION_REQUESTED = "account_confirmation_requested"
ACCOUNT_EMAIL_CHANGED = "account_email_changed"
ACCOUNT_CHANGE_EMAIL_REQUESTED = "account_change_email_requested"
+ ACCOUNT_SET_PASSWORD_REQUESTED = "account_set_password_requested"
ACCOUNT_CONFIRMED = "account_confirmed"
ACCOUNT_DELETE_REQUESTED = "account_delete_requested"
ACCOUNT_DELETED = "account_deleted"
@@ -195,6 +196,10 @@ class WebhookEventAsyncType:
"name": "Account email changed",
"permission": AccountPermissions.MANAGE_USERS,
},
+ ACCOUNT_SET_PASSWORD_REQUESTED: {
+ "name": "Account set password requested",
+ "permission": AccountPermissions.MANAGE_USERS,
+ },
ACCOUNT_CONFIRMED: {
"name": "Account confirmed",
"permission": AccountPermissions.MANAGE_USERS,