File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
app/code/Magento/CustomerGraphQl/Model/Resolver
dev/tests/api-functional/testsuite/Magento/GraphQl/Customer Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 20
20
use Magento \CustomerGraphQl \Model \Customer \ExtractCustomerData ;
21
21
use Magento \Framework \Exception \State \InputMismatchException ;
22
22
use Magento \Framework \Exception \State \InvalidTransitionException ;
23
+ use Magento \Framework \Exception \StateException ;
23
24
use Magento \Framework \GraphQl \Config \Element \Field ;
24
25
use Magento \Framework \GraphQl \Exception \GraphQlInputException ;
25
26
use Magento \Framework \GraphQl \Query \Resolver \Value ;
@@ -66,13 +67,15 @@ public function resolve(
66
67
if (!$ this ->emailValidator ->isValid ($ args ['input ' ]['email ' ])) {
67
68
throw new GraphQlInputException (__ ('Email is invalid ' ));
68
69
}
69
-
70
70
try {
71
71
$ customer = $ this ->accountManagement ->activate ($ args ['input ' ]['email ' ], $ args ['input ' ]['confirmation_key ' ]);
72
72
} catch (InvalidTransitionException | InputMismatchException $ e ) {
73
- throw new GraphQlInputException (__ ($ e ->getMessage ()));
73
+ throw new GraphQlInputException (__ ($ e ->getRawMessage ()));
74
+ } catch (StateException ) {
75
+ throw new GraphQlInputException (__ ('This confirmation key is invalid or has expired. ' ));
76
+ } catch (\Exception ) {
77
+ throw new GraphQlInputException (__ ('There was an error confirming the account ' ));
74
78
}
75
-
76
79
return ['customer ' => $ this ->extractCustomerData ->execute ($ customer )];
77
80
}
78
81
}
Original file line number Diff line number Diff line change @@ -106,6 +106,7 @@ public function testConfirmEmail()
106
106
public function testConfirmEmailWrongEmail ()
107
107
{
108
108
$ this ->expectException (\Exception::class);
109
+ $ this ->expectExceptionMessage ('Email is invalid ' );
109
110
110
111
$ this ->graphQlMutation (
111
112
sprintf (
@@ -126,6 +127,7 @@ public function testConfirmEmailWrongEmail()
126
127
public function testConfirmEmailWrongConfirmation ()
127
128
{
128
129
$ this ->expectException (\Exception::class);
130
+ $ this ->expectExceptionMessage ('The confirmation token is invalid. Verify the token and try again. ' );
129
131
130
132
$ this ->graphQlMutation (
131
133
sprintf (
You can’t perform that action at this time.
0 commit comments