From bf2b4bf9a346714f3d92a86d528e2078aff90385 Mon Sep 17 00:00:00 2001 From: Sudheer S Date: Tue, 29 Sep 2020 17:25:39 +0530 Subject: [PATCH 1/5] 30179: resetPassword mutation returns generic error - fixed the error text issue --- .../Magento/CustomerGraphQl/Model/Resolver/ResetPassword.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/ResetPassword.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/ResetPassword.php index fa2ae669cc89d..a098325c820d6 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/ResetPassword.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/ResetPassword.php @@ -118,7 +118,7 @@ public function resolve( $args['newPassword'] ); } catch (LocalizedException $e) { - throw new GraphQlInputException(__('Cannot set the customer\'s password'), $e); + throw new GraphQlInputException(__($e->getMessage()), $e); } } } From 2c26f7a95b77c1f059c4e93bebae3b278a467ac7 Mon Sep 17 00:00:00 2001 From: Sudheer S Date: Wed, 30 Sep 2020 19:42:56 +0530 Subject: [PATCH 2/5] 30179: resetPassword mutation returns generic error - added API-functional test --- .../Magento/CustomerGraphQl/Model/Resolver/ResetPassword.php | 2 +- .../testsuite/Magento/GraphQl/Customer/ResetPasswordTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/ResetPassword.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/ResetPassword.php index a098325c820d6..1a1a67858ef47 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/ResetPassword.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/ResetPassword.php @@ -118,7 +118,7 @@ public function resolve( $args['newPassword'] ); } catch (LocalizedException $e) { - throw new GraphQlInputException(__($e->getMessage()), $e); + throw new GraphQlInputException(__('The password must be at least 8 characters long, minimum of 3 different classes of characters: Lower Case, Upper Case, Digits, Special Characters.'), $e); } } } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ResetPasswordTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ResetPasswordTest.php index 9c89b80433afd..ad3e0b613f401 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ResetPasswordTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ResetPasswordTest.php @@ -156,7 +156,7 @@ public function testResetPasswordTokenEmptyValue() public function testResetPasswordTokenMismatched() { $this->expectException(\Exception::class); - $this->expectExceptionMessage('Cannot set the customer\'s password'); + $this->expectExceptionMessage('The password must be at least 8 characters long, minimum of 3 different classes of characters: Lower Case, Upper Case, Digits, Special Characters.'); $query = << Date: Wed, 30 Sep 2020 22:22:27 +0530 Subject: [PATCH 3/5] 30179: resetPassword mutation returns generic error - added API-functional test --- .../Magento/CustomerGraphQl/Model/Resolver/ResetPassword.php | 2 +- .../testsuite/Magento/GraphQl/Customer/ResetPasswordTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/ResetPassword.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/ResetPassword.php index 1a1a67858ef47..a098325c820d6 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/ResetPassword.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/ResetPassword.php @@ -118,7 +118,7 @@ public function resolve( $args['newPassword'] ); } catch (LocalizedException $e) { - throw new GraphQlInputException(__('The password must be at least 8 characters long, minimum of 3 different classes of characters: Lower Case, Upper Case, Digits, Special Characters.'), $e); + throw new GraphQlInputException(__($e->getMessage()), $e); } } } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ResetPasswordTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ResetPasswordTest.php index ad3e0b613f401..f097955a95664 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ResetPasswordTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ResetPasswordTest.php @@ -156,7 +156,7 @@ public function testResetPasswordTokenEmptyValue() public function testResetPasswordTokenMismatched() { $this->expectException(\Exception::class); - $this->expectExceptionMessage('The password must be at least 8 characters long, minimum of 3 different classes of characters: Lower Case, Upper Case, Digits, Special Characters.'); + $this->expectExceptionMessage('The password token is mismatched. Reset and try again'); $query = << Date: Thu, 1 Oct 2020 12:50:52 +0530 Subject: [PATCH 4/5] 30179: resetPassword mutation returns generic error - added API-functional test --- .../GraphQl/Customer/ResetPasswordTest.php | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ResetPasswordTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ResetPasswordTest.php index f097955a95664..254bf8c0fa97e 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ResetPasswordTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ResetPasswordTest.php @@ -192,6 +192,52 @@ public function testNewPasswordEmptyValue() $this->graphQlMutation($query); } + /** + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * + * @throws NoSuchEntityException + * @throws Exception + * @throws LocalizedException + */ + public function testNewPasswordCheckMinLength() + { + $this->expectException(\Exception::class); + $this->expectExceptionMessage('The password needs at least 8 characters. Create a new password and try again'); + $query = <<getCustomerEmail()}" + resetPasswordToken: "{$this->getResetPasswordToken()}" + newPassword: "new_" + ) +} +QUERY; + $this->graphQlMutation($query); + } + + /** + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * + * @throws NoSuchEntityException + * @throws Exception + * @throws LocalizedException + */ + public function testNewPasswordCheckCharactersStrenth() + { + $this->expectException(\Exception::class); + $this->expectExceptionMessage('Minimum of different classes of characters in password is 3. Classes of characters: Lower Case, Upper Case, Digits, Special Characters.'); + $query = <<getCustomerEmail()}" + resetPasswordToken: "{$this->getResetPasswordToken()}" + newPassword: "new_password" + ) +} +QUERY; + $this->graphQlMutation($query); + } + /** * Check password reset for lock customer * From cff5e3afb691d39b28de0a1786e1729c6faf4c97 Mon Sep 17 00:00:00 2001 From: Sudheer S Date: Mon, 5 Oct 2020 10:41:19 +0530 Subject: [PATCH 5/5] 30179: resetPassword mutation returns generic error - fixed typo error --- .../testsuite/Magento/GraphQl/Customer/ResetPasswordTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ResetPasswordTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ResetPasswordTest.php index 254bf8c0fa97e..be6513c75b081 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ResetPasswordTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ResetPasswordTest.php @@ -222,7 +222,7 @@ public function testNewPasswordCheckMinLength() * @throws Exception * @throws LocalizedException */ - public function testNewPasswordCheckCharactersStrenth() + public function testNewPasswordCheckCharactersStrength() { $this->expectException(\Exception::class); $this->expectExceptionMessage('Minimum of different classes of characters in password is 3. Classes of characters: Lower Case, Upper Case, Digits, Special Characters.');