Skip to content

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

Use INVALID_CREDENTIALS instead of INVALID_PASSWORD error

Michał Sipac4b64abbc794
diff --git a/saleor/graphql/account/mutations/account.py b/saleor/graphql/account/mutations/account.py
index 2cc4b1ec65..f0f2d44cb8 100644
--- a/saleor/graphql/account/mutations/account.py
+++ b/saleor/graphql/account/mutations/account.py
@@ -384,7 +384,8 @@ class RequestEmailChange(BaseMutation):
raise ValidationError(
{
"password": ValidationError(
- "Password isn't valid.", code=AccountErrorCode.INVALID_PASSWORD
+ "Password isn't valid.",
+ code=AccountErrorCode.INVALID_CREDENTIALS,
)
}
)
diff --git a/saleor/graphql/account/mutations/base.py b/saleor/graphql/account/mutations/base.py
index febfba251c..bceea4f191 100644
--- a/saleor/graphql/account/mutations/base.py
+++ b/saleor/graphql/account/mutations/base.py
@@ -213,7 +213,7 @@ class PasswordChange(BaseMutation):
{
"old_password": ValidationError(
"Old password isn't valid.",
- code=AccountErrorCode.INVALID_PASSWORD,
+ code=AccountErrorCode.INVALID_CREDENTIALS,
)
}
)
diff --git a/tests/api/test_account.py b/tests/api/test_account.py
index 3947727243..d62da3564e 100644
--- a/tests/api/test_account.py
+++ b/tests/api/test_account.py
@@ -3269,7 +3269,7 @@ def test_request_email_change_with_invalid_password(user_api_client, customer_us
content = get_graphql_content(response)
data = content["data"]["requestEmailChange"]
assert not data["user"]
- assert data["accountErrors"][0]["code"] == AccountErrorCode.INVALID_PASSWORD.name
+ assert data["accountErrors"][0]["code"] == AccountErrorCode.INVALID_CREDENTIALS.name
assert data["accountErrors"][0]["field"] == "password"