Skip to content

Commit

Permalink
changed errors messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Usik2203 committed May 8, 2020
1 parent d363a5d commit 0b079a8
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,17 @@ public function resolve(
array $args = null
) {
if (empty($args['email'])) {
throw new GraphQlInputException(__('Email must be specified'));
throw new GraphQlInputException(__('You must specify an email address.'));
}

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

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

if (true === $this->authentication->isLocked($customer->getId())) {
Expand All @@ -110,7 +110,7 @@ public function resolve(
AccountManagement::EMAIL_RESET
);
} catch (LocalizedException $e) {
throw new GraphQlInputException(__('Cannot reset customer password'), $e);
throw new GraphQlInputException(__('Cannot reset the customer\'s password'), $e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ public function resolve(
array $args = null
) {
if (empty($args['email'])) {
throw new GraphQlInputException(__('Email must be specified'));
throw new GraphQlInputException(__('You must specify an email address.'));
}

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

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

if (true === $this->authentication->isLocked($customer->getId())) {
Expand All @@ -118,7 +118,7 @@ public function resolve(
$args['newPassword']
);
} catch (LocalizedException $e) {
throw new GraphQlInputException(__('Cannot set customer password'), $e);
throw new GraphQlInputException(__('Cannot set the customer\'s password'), $e);
}
}
}
12 changes: 6 additions & 6 deletions app/code/Magento/CustomerGraphQl/etc/schema.graphqls
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Copyright © Magento, Inc. All rights reserved.
# See COPYING.txt for license details.

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

type Query {
Expand All @@ -23,8 +23,8 @@ type Mutation {
createCustomerAddress(input: CustomerAddressInput!): CustomerAddress @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\CreateCustomerAddress") @doc(description: "Create customer address")
updateCustomerAddress(id: Int!, input: CustomerAddressInput): CustomerAddress @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\UpdateCustomerAddress") @doc(description: "Update customer address")
deleteCustomerAddress(id: Int!): Boolean @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\DeleteCustomerAddress") @doc(description: "Delete customer address")
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")
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")
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.")
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.")
}

input CustomerAddressInput {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function testCustomerAccountWithEmailAvailable()
* Check if customer account is not available
*
* @expectedException \Exception
* @expectedExceptionMessage Cannot reset customer password
* @expectedExceptionMessage Cannot reset the customer's password
*/
public function testCustomerAccountWithEmailNotAvailable()
{
Expand All @@ -61,7 +61,7 @@ public function testCustomerAccountWithEmailNotAvailable()
* Check if email value empty
*
* @expectedException \Exception
* @expectedExceptionMessage Email must be specified
* @expectedExceptionMessage You must specify an email address.
*/
public function testEmailAvailableEmptyValue()
{
Expand All @@ -77,7 +77,7 @@ public function testEmailAvailableEmptyValue()
* Check if email is invalid
*
* @expectedException \Exception
* @expectedExceptionMessage Email is invalid
* @expectedExceptionMessage The email address has an invalid format.
*/
public function testEmailAvailableInvalidValue()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function testResetCustomerAccountPasswordSuccessfully(): void
* @magentoApiDataFixture Magento/Customer/_files/customer.php
*
* @expectedException \Exception
* @expectedExceptionMessage Email must be specified
* @expectedExceptionMessage You must specify an email address.
*
* @throws NoSuchEntityException
* @throws Exception
Expand All @@ -105,7 +105,7 @@ public function testEmailAvailableEmptyValue()
* @magentoApiDataFixture Magento/Customer/_files/customer.php
*
* @expectedException \Exception
* @expectedExceptionMessage Email is invalid
* @expectedExceptionMessage The email address has an invalid format.
*
* @throws NoSuchEntityException
* @throws Exception
Expand Down Expand Up @@ -153,7 +153,7 @@ public function testResetPasswordTokenEmptyValue()
* @magentoApiDataFixture Magento/Customer/_files/customer.php
*
* @expectedException \Exception
* @expectedExceptionMessage Cannot set customer password
* @expectedExceptionMessage Cannot set the customer's password
*
* @throws NoSuchEntityException
* @throws Exception
Expand Down

0 comments on commit 0b079a8

Please sign in to comment.