Skip to content

Commit 0b079a8

Browse files
committed
changed errors messages
1 parent d363a5d commit 0b079a8

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

app/code/Magento/CustomerGraphQl/Model/Resolver/RequestPasswordResetEmail.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,17 @@ public function resolve(
8787
array $args = null
8888
) {
8989
if (empty($args['email'])) {
90-
throw new GraphQlInputException(__('Email must be specified'));
90+
throw new GraphQlInputException(__('You must specify an email address.'));
9191
}
9292

9393
if (!$this->emailValidator->isValid($args['email'])) {
94-
throw new GraphQlInputException(__('Email is invalid'));
94+
throw new GraphQlInputException(__('The email address has an invalid format.'));
9595
}
9696

9797
try {
9898
$customer = $this->customerRepository->get($args['email']);
9999
} catch (LocalizedException $e) {
100-
throw new GraphQlInputException(__('Cannot reset customer password'), $e);
100+
throw new GraphQlInputException(__('Cannot reset the customer\'s password'), $e);
101101
}
102102

103103
if (true === $this->authentication->isLocked($customer->getId())) {
@@ -110,7 +110,7 @@ public function resolve(
110110
AccountManagement::EMAIL_RESET
111111
);
112112
} catch (LocalizedException $e) {
113-
throw new GraphQlInputException(__('Cannot reset customer password'), $e);
113+
throw new GraphQlInputException(__('Cannot reset the customer\'s password'), $e);
114114
}
115115
}
116116
}

app/code/Magento/CustomerGraphQl/Model/Resolver/ResetPassword.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ public function resolve(
8686
array $args = null
8787
) {
8888
if (empty($args['email'])) {
89-
throw new GraphQlInputException(__('Email must be specified'));
89+
throw new GraphQlInputException(__('You must specify an email address.'));
9090
}
9191

9292
if (!$this->emailValidator->isValid($args['email'])) {
93-
throw new GraphQlInputException(__('Email is invalid'));
93+
throw new GraphQlInputException(__('The email address has an invalid format.'));
9494
}
9595

9696
if (empty($args['resetPasswordToken'])) {
@@ -104,7 +104,7 @@ public function resolve(
104104
try {
105105
$customer = $this->customerRepository->get($args['email']);
106106
} catch (LocalizedException $e) {
107-
throw new GraphQlInputException(__('Cannot set customer password'), $e);
107+
throw new GraphQlInputException(__('Cannot set the customer\'s password'), $e);
108108
}
109109

110110
if (true === $this->authentication->isLocked($customer->getId())) {
@@ -118,7 +118,7 @@ public function resolve(
118118
$args['newPassword']
119119
);
120120
} catch (LocalizedException $e) {
121-
throw new GraphQlInputException(__('Cannot set customer password'), $e);
121+
throw new GraphQlInputException(__('Cannot set the customer\'s password'), $e);
122122
}
123123
}
124124
}

app/code/Magento/CustomerGraphQl/etc/schema.graphqls

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Copyright © Magento, Inc. All rights reserved.
22
# See COPYING.txt for license details.
33

4-
type StoreConfig @doc(description: "The type contains information about a store config") {
5-
required_character_classes_number : String @doc(description: "Number of Required Character Classes")
6-
minimum_password_length : String @doc(description: "Minimum Password Length")
7-
autocomplete_on_storefront : Boolean @doc(description: "Enable Autocomplete on login or forgot password forms")
4+
type StoreConfig {
5+
required_character_classes_number : String @doc(description: "The number of different character classes required in a password (lowercase, uppercase, digits, special characters).")
6+
minimum_password_length : String @doc(description: "The minimum number of characters required for a valid password.")
7+
autocomplete_on_storefront : Boolean @doc(description: "Enable autocomplete on login and forgot password forms")
88
}
99

1010
type Query {
@@ -23,8 +23,8 @@ type Mutation {
2323
createCustomerAddress(input: CustomerAddressInput!): CustomerAddress @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\CreateCustomerAddress") @doc(description: "Create customer address")
2424
updateCustomerAddress(id: Int!, input: CustomerAddressInput): CustomerAddress @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\UpdateCustomerAddress") @doc(description: "Update customer address")
2525
deleteCustomerAddress(id: Int!): Boolean @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\DeleteCustomerAddress") @doc(description: "Delete customer address")
26-
requestPasswordResetEmail(email: String!): Boolean @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\RequestPasswordResetEmail") @doc(description: "Request an email with reset password token for the registered customer identified by the provided email")
27-
resetPassword(email: String!, resetPasswordToken: String!, newPassword: String!): Boolean @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\ResetPassword") @doc(description: "Reset customer password using reset password token received in the email after requesting it using requestPasswordResetEmail")
26+
requestPasswordResetEmail(email: String!): Boolean @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\RequestPasswordResetEmail") @doc(description: "Request an email with a reset password token for the registered customer identified by the specified email.")
27+
resetPassword(email: String!, resetPasswordToken: String!, newPassword: String!): Boolean @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\ResetPassword") @doc(description: "Reset a customer's password using the reset password token that the customer received in an email after requesting it using requestPasswordResetEmail.")
2828
}
2929

3030
input CustomerAddressInput {

dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/RequestPasswordResetEmailTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function testCustomerAccountWithEmailAvailable()
4444
* Check if customer account is not available
4545
*
4646
* @expectedException \Exception
47-
* @expectedExceptionMessage Cannot reset customer password
47+
* @expectedExceptionMessage Cannot reset the customer's password
4848
*/
4949
public function testCustomerAccountWithEmailNotAvailable()
5050
{
@@ -61,7 +61,7 @@ public function testCustomerAccountWithEmailNotAvailable()
6161
* Check if email value empty
6262
*
6363
* @expectedException \Exception
64-
* @expectedExceptionMessage Email must be specified
64+
* @expectedExceptionMessage You must specify an email address.
6565
*/
6666
public function testEmailAvailableEmptyValue()
6767
{
@@ -77,7 +77,7 @@ public function testEmailAvailableEmptyValue()
7777
* Check if email is invalid
7878
*
7979
* @expectedException \Exception
80-
* @expectedExceptionMessage Email is invalid
80+
* @expectedExceptionMessage The email address has an invalid format.
8181
*/
8282
public function testEmailAvailableInvalidValue()
8383
{

dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ResetPasswordTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function testResetCustomerAccountPasswordSuccessfully(): void
8181
* @magentoApiDataFixture Magento/Customer/_files/customer.php
8282
*
8383
* @expectedException \Exception
84-
* @expectedExceptionMessage Email must be specified
84+
* @expectedExceptionMessage You must specify an email address.
8585
*
8686
* @throws NoSuchEntityException
8787
* @throws Exception
@@ -105,7 +105,7 @@ public function testEmailAvailableEmptyValue()
105105
* @magentoApiDataFixture Magento/Customer/_files/customer.php
106106
*
107107
* @expectedException \Exception
108-
* @expectedExceptionMessage Email is invalid
108+
* @expectedExceptionMessage The email address has an invalid format.
109109
*
110110
* @throws NoSuchEntityException
111111
* @throws Exception
@@ -153,7 +153,7 @@ public function testResetPasswordTokenEmptyValue()
153153
* @magentoApiDataFixture Magento/Customer/_files/customer.php
154154
*
155155
* @expectedException \Exception
156-
* @expectedExceptionMessage Cannot set customer password
156+
* @expectedExceptionMessage Cannot set the customer's password
157157
*
158158
* @throws NoSuchEntityException
159159
* @throws Exception

0 commit comments

Comments
 (0)