Skip to content

Commit 11b6315

Browse files
committed
checking if user exists and changing notification message if the link is incorrect
1 parent d488c4a commit 11b6315

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Model/Resolver/ResetPassword.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class ResetPassword implements ResolverInterface {
4040
/**
4141
* @var CustomerRepositoryInterface
4242
*/
43-
private $customerRepository;
43+
protected $customerRepository;
4444

4545
/**
4646
* ResetPassword constructor.
@@ -72,7 +72,11 @@ public function resolve(
7272
$passwordConfirmation = $args['password_confirmation'];
7373
$customerId = $args['customer_id'];
7474

75-
$customerEmail = $this->customerRepository->getById($customerId)->getEmail();
75+
try {
76+
$customerEmail = $this->customerRepository->getById($customerId)->getEmail();
77+
} catch (\Exception $exception) {
78+
throw new GraphQlInputException(__('No customer found'));
79+
}
7680

7781
if ($password !== $passwordConfirmation) {
7882
return [
@@ -95,7 +99,7 @@ public function resolve(
9599
} catch (InputException $e) {
96100
throw new GraphQlInputException(__($e->getMessage()));
97101
} catch (\Exception $exception) {
98-
throw new GraphQlInputException(__('Something went wrong while saving the new password.'));
102+
throw new GraphQlInputException(__('Your password reset link has expired.'));
99103
}
100104
}
101105
}

0 commit comments

Comments
 (0)