Skip to content

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

Fix review remarks

fowczarek240c7af36f2a
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fe82c28ff9..cd80368f54 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -52,7 +52,7 @@ All notable, unreleased changes to this project will be documented in this file.
- Remove dashboard 2.0 files - #4631 by @dominik-zeglen
- Refactoring of password recovery system - #4617 by @fowczarek
- Added capability to filter attributes per global ID - #4640 by @NyanKiyoshi.
-- Add mutation for change authenticated user password - #4656 by @fowczarek
+- Add mutation to change the authenticated user's password - #4656 by @fowczarek
## 2.8.0
diff --git a/saleor/account/__init__.py b/saleor/account/__init__.py
index 00a497d076..ffd3a77857 100755
--- a/saleor/account/__init__.py
+++ b/saleor/account/__init__.py
@@ -8,7 +8,7 @@ class CustomerEvents:
ACCOUNT_CREATED = "account_created"
PASSWORD_RESET_LINK_SENT = "password_reset_link_sent"
PASSWORD_RESET = "password_reset"
- PASSWORD_CHANGE = "password_change"
+ PASSWORD_CHANGED = "password_changed"
# Order related events
PLACED_ORDER = "placed_order" # created an order
diff --git a/saleor/account/events.py b/saleor/account/events.py
index d8e3e670c2..43c43373ad 100644
--- a/saleor/account/events.py
+++ b/saleor/account/events.py
@@ -25,8 +25,8 @@ def customer_password_reset_event(*, user: UserType) -> Optional[CustomerEvent]:
return CustomerEvent.objects.create(user=user, type=CustomerEvents.PASSWORD_RESET)
-def customer_password_change_event(*, user: UserType) -> Optional[CustomerEvent]:
- return CustomerEvent.objects.create(user=user, type=CustomerEvents.PASSWORD_CHANGE)
+def customer_password_changed_event(*, user: UserType) -> Optional[CustomerEvent]:
+ return CustomerEvent.objects.create(user=user, type=CustomerEvents.PASSWORD_CHANGED)
def customer_placed_order_event(
diff --git a/saleor/graphql/account/mutations/base.py b/saleor/graphql/account/mutations/base.py
index 5da262f870..8f2e864329 100644
--- a/saleor/graphql/account/mutations/base.py
+++ b/saleor/graphql/account/mutations/base.py
@@ -145,7 +145,7 @@ class PasswordChange(BaseMutation):
user.set_password(new_password)
user.save(update_fields=["password"])
- account_events.customer_password_change_event(user=user)
+ account_events.customer_password_changed_event(user=user)
return PasswordChange(user=user)
diff --git a/tests/api/test_account.py b/tests/api/test_account.py
index 31df43d691..456c2f2399 100644
--- a/tests/api/test_account.py
+++ b/tests/api/test_account.py
@@ -1501,7 +1501,7 @@ def test_password_change(user_api_client):
assert customer_user.check_password(new_password)
password_change_event = account_events.CustomerEvent.objects.get()
- assert password_change_event.type == account_events.CustomerEvents.PASSWORD_CHANGE
+ assert password_change_event.type == account_events.CustomerEvents.PASSWORD_CHANGED
assert password_change_event.user == customer_user