Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

30179: resetPassword mutation returns generic error #30230

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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(__('The password must be at least 8 characters long, minimum of 3 different classes of characters: Lower Case, Upper Case, Digits, Special Characters.'), $e);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sudheers-kensium we try not add new phrases. $e->getMessage() should bubble up the exceptions from the api, which will be more meaningful and is the scope of this bug. $this->customerAccountManagement->resetPassword throws Input Exceptions, you can catch them in the resolver to give meaningful error responses back. For example, I see a bunch of meaningful validations here \Magento\Customer\Model\AccountManagement::checkPasswordStrength
Once you're able to get those messages, you can cover a couple in api functional tests, just to make sure the validation errors are being thrown.

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <<<QUERY
mutation {
resetPassword (
Expand Down